Method: Effective::CodeReader#first
- Defined in:
- app/models/effective/code_reader.rb
#first(from: nil, to: nil, &block) ⇒ Object Also known as: find
Returns the stripped contents of the line in which the passed block returns true
32 33 34 35 36 |
# File 'app/models/effective/code_reader.rb', line 32 def first(from: nil, to: nil, &block) each_with_depth(from: from, to: to) do |line, depth, index| return line if block.call(line, depth, index) end end |