Module: Hashie::Extensions::DeepLocate
- Defined in:
- lib/hashie/extensions/deep_locate.rb
Class Method Summary collapse
-
.deep_locate(comparator, object) ⇒ Object
The module level implementation of #deep_locate, incase you do not want to include/extend the base datastructure.
Instance Method Summary collapse
-
#deep_locate(comparator) ⇒ Object
Performs a depth-first search on deeply nested data structures for a given comparator callable and returns each Enumerable, for which the callable returns true for at least one the its elements.
Class Method Details
.deep_locate(comparator, object) ⇒ Object
The module level implementation of #deep_locate, incase you do not want to include/extend the base datastructure. For further examples please see #deep_locate.
19 20 21 22 23 24 25 |
# File 'lib/hashie/extensions/deep_locate.rb', line 19 def self.deep_locate(comparator, object) unless comparator.respond_to?(:call) comparator = _construct_key_comparator(comparator, object) end _deep_locate(comparator, object) end |
Instance Method Details
#deep_locate(comparator) ⇒ Object
Performs a depth-first search on deeply nested data structures for a given comparator callable and returns each Enumerable, for which the callable returns true for at least one the its elements.
64 65 66 |
# File 'lib/hashie/extensions/deep_locate.rb', line 64 def deep_locate(comparator) Hashie::Extensions::DeepLocate.deep_locate(comparator, self) end |