Method: Enumerable#first

Defined in:
lib/jinx/helpers/enumerable.rb

#firstObject

This method is functionally equivalent to to_a.first but is more concise and efficient.

Returns:

  • the first enumerated item in this Enumerable, or nil if this Enumerable is empty



68
69
70
# File 'lib/jinx/helpers/enumerable.rb', line 68

def first
  detect { true }
end