Why not use join instead
I am looking at the source code of cache_fu and this is what I found.
def config_args
args = {
'-p' => Array(config['servers']).first.split(':').last,
'-c' => config['c_threshold'],
'-m' => config['memory'],
'-d' => ''
}
args.to_a * ' '
end
def memcached(*args)
`/usr/bin/env memcached #{args * ' '}`
end
For those who are not aware of “*” method from Array here is the link of documentation.
As far as I can remember join method has been there in Array since beginning.
Anytime I look at code mentioned above my brain goes through a halt. I need to stop to process what the method is doing. I know ruby allows one to achieve same goal through various means but this one is over the top for me. Just use simple code that others can understand. Why complicate things?