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.
279 280 281 282 283 284 285 286 287 288 |
# File 'lib/erb/compiler.rb', line 279 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.
289 290 291 |
# File 'lib/erb/compiler.rb', line 289 def script @script end |
Instance Method Details
#close ⇒ Object
301 302 303 304 305 306 307 308 |
# File 'lib/erb/compiler.rb', line 301 def close return unless @line @compiler.post_cmd.each do |x| push(x) end @script << (@line.join('; ')) @line = nil end |
#cr ⇒ Object
295 296 297 298 299 |
# File 'lib/erb/compiler.rb', line 295 def cr @script << (@line.join('; ')) @line = [] @script << "\n" end |
#push(cmd) ⇒ Object
291 292 293 |
# File 'lib/erb/compiler.rb', line 291 def push(cmd) @line << cmd end |