Combine keys and values in RUBY -


given hash:

{:a => "123", :b => "345", :c => "678", :d => "910"} 

write code generates array combines keys , values. resulting array should be:

["a123", "b345", "c678", "d910"] 

i this:

{:a => "123", :b => "345", :c => "678", :d => "910"}.map { |k, v| "#{k}#{v}" } #=> ["a123", "b345", "c678", "d910"] 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -