Module: Enumerable

Defined in:
lib/git_stats/core_extensions/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#first!(&block) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/git_stats/core_extensions/enumerable.rb', line 2

def first!(&block)
  matching = find(&block)
  if matching.nil?
    raise "Sequence contains no matching elements"
  else
    matching
  end
end