Class: Darthjee::CoreExt::Hash::ToHashMapper
- Defined in:
- lib/darthjee/core_ext/hash/to_hash_mapper.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ ToHashMapper
constructor
A new instance of ToHashMapper.
- #map ⇒ Object
Constructor Details
#initialize(hash) ⇒ ToHashMapper
Returns a new instance of ToHashMapper.
7 8 9 |
# File 'lib/darthjee/core_ext/hash/to_hash_mapper.rb', line 7 def initialize(hash) @hash = hash end |
Instance Method Details
#map ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/darthjee/core_ext/hash/to_hash_mapper.rb', line 11 def map {}.tap do |new_hash| hash.each do |k, v| new_hash[k] = yield(k, v) end end end |