Module: Enumerable
- Defined in:
- lib/maveric/extensions.rb
Instance Method Summary collapse
-
#eject(&block) ⇒ Object
Used to return the first value for which the given block evalutes as true.
Instance Method Details
#eject(&block) ⇒ Object
Used to return the first value for which the given block evalutes as true. Think .map(&b).compact.first
39 40 41 |
# File 'lib/maveric/extensions.rb', line 39 def eject &block find{|e| result = block[e] and break result } end |