Class: Eceval::EvaluationContext

Inherits:
Object
  • Object
show all
Defined in:
lib/eceval.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename:, lineno: 1) ⇒ EvaluationContext

Returns a new instance of EvaluationContext.



26
27
28
29
30
31
# File 'lib/eceval.rb', line 26

def initialize(filename:, lineno: 1)
  @filename = filename
  @lineno = lineno
  @lines_consumed = 0
  @chunk = nil
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



24
25
26
# File 'lib/eceval.rb', line 24

def filename
  @filename
end

#linenoObject (readonly)

Returns the value of attribute lineno.



24
25
26
# File 'lib/eceval.rb', line 24

def lineno
  @lineno
end

Instance Method Details

#process_line(line) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/eceval.rb', line 33

def process_line(line)
  if @chunk
    process_code_line(line)
  else
    process_noncode_line(line)
  end
ensure
  @lines_consumed += 1
end