Class: Eceval::Chunk
- Inherits:
-
Object
- Object
- Eceval::Chunk
- 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
- #<<(line) ⇒ Object
- #evaluate ⇒ Object
-
#initialize(filename:, lineno:) ⇒ Chunk
constructor
A new instance of Chunk.
Constructor Details
#initialize(filename:, lineno:) ⇒ Chunk
Returns a new instance of Chunk.
142 143 144 145 146 |
# File 'lib/eceval.rb', line 142 def initialize(filename:, lineno:) @filename = filename @lineno = lineno @buffered_lines = [] end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
140 141 142 |
# File 'lib/eceval.rb', line 140 def filename @filename end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
140 141 142 |
# File 'lib/eceval.rb', line 140 def lineno @lineno end |
Instance Method Details
#<<(line) ⇒ Object
148 149 150 |
# File 'lib/eceval.rb', line 148 def <<(line) @buffered_lines << line end |
#evaluate ⇒ Object
152 153 154 |
# File 'lib/eceval.rb', line 152 def evaluate ECEVAL_MAIN_BINDING.eval(@buffered_lines.join("\n"), filename, lineno) end |