Using Ruby, how do I convert all array values to a given type? -


i need convert fixnums strings. solution is:

arr.map {|a| a.to_s} 

is there better way?

arr.map(&:to_s) 

this uses spiffy new feature in ruby >= 1.8.7, "symbol proc" shortcut, , equivalent code in question.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -