Method: Effective::CodeReader#last

Defined in:
app/models/effective/code_reader.rb

#last(from: nil, to: nil, &block) ⇒ Object

Returns the stripped contents of the last line where the passed block returns true



40
41
42
43
44
45
46
47
48
# File 'app/models/effective/code_reader.rb', line 40

def last(from: nil, to: nil, &block)
  retval = nil

  each_with_depth(from: from, to: nil) do |line, depth, index|
    retval = line if block.call(line, depth, index)
  end

  retval
end