Class: Eceval::EvaluationContext
- Inherits:
-
Object
- Object
- Eceval::EvaluationContext
- Defined in:
- lib/eceval.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
Instance Method Summary collapse
-
#initialize(filename:, lineno: 1) ⇒ EvaluationContext
constructor
A new instance of EvaluationContext.
- #process_line(line) ⇒ Object
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
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
27 28 29 |
# File 'lib/eceval.rb', line 27 def filename @filename end |
#lineno ⇒ Object (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 |