Class: Array

Inherits:
Object show all
Defined in:
lib/ctx.rb

Instance Method Summary collapse

Instance Method Details

#return_first(&block) ⇒ Object



4
5
6
7
8
# File 'lib/ctx.rb', line 4

def return_first(&block)
  returned = nil
  each { |item| break if (returned = block.call(item)) }
  returned
end