Module: Enumerable
- Defined in:
- lib/core_utilities/core_ext/enumerable.rb
Instance Method Summary collapse
Instance Method Details
#map_detect(value_for_no_matching = nil) ⇒ Object
8 9 10 11 |
# File 'lib/core_utilities/core_ext/enumerable.rb', line 8 def map_detect(value_for_no_matching = nil) self.each { |el| if result = yield(el) then return result end } value_for_no_matching end |
#map_select(value_for_skip = nil) ⇒ Object
2 3 4 5 6 |
# File 'lib/core_utilities/core_ext/enumerable.rb', line 2 def map_select(value_for_skip = nil) self.inject([]) do |acc, item| (value = yield(item)) == value_for_skip ? acc : acc << value end end |