Module: Enumerable

Defined in:
lib/evoke_client/mash.rb

Instance Method Summary collapse

Instance Method Details

#mashObject

Let’s you do stuff like:

hashed_users = [:id, :name].mash {|attr| {attr => attr.to_s} }
=> {:id => 'id', :name => 'name'}


6
7
8
# File 'lib/evoke_client/mash.rb', line 6

def mash
  self.inject({}) { |a,i| a.merge( yield(i) ) }
end