Method: DebuggerCode#before

Defined in:
lib/puppet-debugger/debugger_code.rb

#before(lineno, lines = 1) ⇒ Code

Remove all lines except for the lines up to and excluding lineno.

Parameters:

  • lineno (Integer)
  • lines (Integer) (defaults to: 1)

Returns:

  • (Code)


126
127
128
129
130
131
132
# File 'lib/puppet-debugger/debugger_code.rb', line 126

def before(lineno, lines = 1)
  return self unless lineno

  select do |loc|
    loc.lineno >= lineno - lines && loc.lineno < lineno
  end
end