Method: Enumerable#detect_value
- Defined in:
- lib/jinx/helpers/enumerable.rb
#detect_value ⇒ Object
Returns the first non-nil, non-false enumerated value resulting from a call to the block given to this method, or nil if no value detected.
101 102 103 104 105 106 107 |
# File 'lib/jinx/helpers/enumerable.rb', line 101 def detect_value each do |*item| value = yield(*item) return value if value end nil end |