Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/leap/core_ext.rb
Instance Method Summary collapse
-
#grab(&blk) ⇒ Object
like detect, but returns the calculated value.
Instance Method Details
#grab(&blk) ⇒ Object
like detect, but returns the calculated value
3 4 5 6 7 8 9 10 |
# File 'lib/leap/core_ext.rb', line 3 def grab(&blk) result = each do |element| value = yield element break value if value end return if result == self result end |