Module: Darthjee::CoreExt::Hash
- Includes:
- Cameliazable, Changeable, KeyChangeable, Transformable, Transposeable
- Included in:
- Hash
- Defined in:
- lib/darthjee/core_ext/hash.rb,
lib/darthjee/core_ext/hash/squasher.rb,
lib/darthjee/core_ext/hash/changeable.rb,
lib/darthjee/core_ext/hash/key_changer.rb,
lib/darthjee/core_ext/hash/keys_sorter.rb,
lib/darthjee/core_ext/hash/cameliazable.rb,
lib/darthjee/core_ext/hash/chain_fetcher.rb,
lib/darthjee/core_ext/hash/transformable.rb,
lib/darthjee/core_ext/hash/transposeable.rb,
lib/darthjee/core_ext/hash/value_changer.rb,
lib/darthjee/core_ext/hash/key_changeable.rb,
lib/darthjee/core_ext/hash/deep_hash_constructor.rb,
lib/darthjee/core_ext/hash/deep_hash_constructor/setter.rb
Defined Under Namespace
Modules: Cameliazable, Changeable, KeyChangeable, Transformable, Transposeable Classes: ChainFetcher, DeepHashConstructor, KeyChanger, KeysSorter, Squasher, ValueChanger
Instance Method Summary collapse
-
#chain_fetch(*keys, &block) {|key_not_found, keys_missing| ... } ⇒ ::Object
Crawls through the hash fetching a key value from inside it.
Methods included from Transformable
#exclusive_merge, #exclusive_merge!, #map_to_hash, #squash, #squash!, #to_deep_hash, #to_deep_hash!
Methods included from Transposeable
Methods included from Changeable
#change_values, #change_values!
Methods included from KeyChangeable
#append_to_keys, #chain_change_keys, #chain_change_keys!, #change_keys, #change_keys!, #prepend_to_keys, #remap_keys, #remap_keys!, #sort_keys, #sort_keys!
Methods included from Cameliazable
#camelize_keys, #camelize_keys!, #lower_camelize_keys, #lower_camelize_keys!, #underscore_keys, #underscore_keys!
Instance Method Details
#chain_fetch(*keys, &block) {|key_not_found, keys_missing| ... } ⇒ ::Object
Crawls through the hash fetching a key value from inside it
this is the equivalent of chaining several calls to fetch method
“‘
hash.chain_fetch(:key1, :key2)
hash.fetch(:key1).fetch(:key2)
“‘
58 59 60 |
# File 'lib/darthjee/core_ext/hash.rb', line 58 def chain_fetch(*keys, &block) ::Hash::ChainFetcher.new(self, *keys, &block).fetch end |