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.



29
30
31
32
33
34
35
# File 'lib/eceval.rb', line 29

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

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



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

def filename
  @filename
end

#linenoObject (readonly)

Returns the value of attribute lineno.



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

def lineno
  @lineno
end

Instance Method Details

#process_line(line) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/eceval.rb', line 37

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