Method: Effective::CodeReader#index
- Defined in:
- app/models/effective/code_reader.rb
#index(from: nil, to: nil, &block) ⇒ Object
Returns the index of the first line where the passed block returns true
25 26 27 28 29 |
# File 'app/models/effective/code_reader.rb', line 25 def index(from: nil, to: nil, &block) each_with_depth(from: from, to: to) do |line, depth, index| return index if block.call(line, depth, index) end end |