Module: Enumerable

Defined in:
lib/opswalrus/patches.rb

Instance Method Summary collapse

Instance Method Details

#find_map(&block) ⇒ Object

calls the block with successive elements; returns the first truthy object returned by the block



53
54
55
56
57
58
59
# File 'lib/opswalrus/patches.rb', line 53

def find_map(&block)
  each do |element|
    mapped_value = block.call(element)
    return mapped_value if mapped_value
  end
  nil
end