Class: ERB::Compiler::Buffer
- Inherits:
-
Object
- Object
- ERB::Compiler::Buffer
- Defined in:
- lib/erb/compiler.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Instance Method Summary collapse
- #close ⇒ Object
- #cr ⇒ Object
-
#initialize(compiler, enc = nil, frozen = nil) ⇒ Buffer
constructor
A new instance of Buffer.
- #push(cmd) ⇒ Object
Constructor Details
#initialize(compiler, enc = nil, frozen = nil) ⇒ Buffer
Returns a new instance of Buffer.
273 274 275 276 277 278 279 280 281 282 |
# File 'lib/erb/compiler.rb', line 273 def initialize(compiler, enc=nil, frozen=nil) @compiler = compiler @line = [] @script = +'' @script << "#coding:#{enc}\n" if enc @script << "#frozen-string-literal:#{frozen}\n" unless frozen.nil? @compiler.pre_cmd.each do |x| push(x) end end |
Instance Attribute Details
#script ⇒ Object (readonly)
Returns the value of attribute script.
283 284 285 |
# File 'lib/erb/compiler.rb', line 283 def script @script end |
Instance Method Details
#close ⇒ Object
295 296 297 298 299 300 301 302 |
# File 'lib/erb/compiler.rb', line 295 def close return unless @line @compiler.post_cmd.each do |x| push(x) end @script << (@line.join('; ')) @line = nil end |
#cr ⇒ Object
289 290 291 292 293 |
# File 'lib/erb/compiler.rb', line 289 def cr @script << (@line.join('; ')) @line = [] @script << "\n" end |
#push(cmd) ⇒ Object
285 286 287 |
# File 'lib/erb/compiler.rb', line 285 def push(cmd) @line << cmd end |