Method: Enumerable#search

Defined in:
lib/hobosupport/enumerable.rb

#search(not_found = nil) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/hobosupport/enumerable.rb', line 3

def search(not_found=nil)
  each do |x|
    val = yield(x)
    return val if val
  end
  not_found
end