Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/ebsco/eds/info.rb,
lib/ebsco/eds/record.rb
Overview
monkey patches
Instance Method Summary collapse
- #deep_find(key, object = self, found = []) ⇒ Object
- #deep_find_results(key, object = self, found = []) ⇒ Object
Instance Method Details
#deep_find(key, object = self, found = []) ⇒ Object
1029 1030 1031 1032 1033 1034 1035 1036 1037 |
# File 'lib/ebsco/eds/record.rb', line 1029 def deep_find(key, object=self, found=[]) if object.respond_to?(:key?) && object.key?(key) found << object[key] end if object.is_a? Enumerable found << object.collect { |*a| deep_find(key, a.last) } end found.flatten.compact end |
#deep_find_results(key, object = self, found = []) ⇒ Object
219 220 221 222 223 224 225 226 227 |
# File 'lib/ebsco/eds/info.rb', line 219 def deep_find_results(key, object=self, found=[]) if object.respond_to?(:key?) && object.key?(key) found << object[key] end if object.is_a? Enumerable found << object.collect { |*a| deep_find(key, a.last) } end found.flatten.compact end |