Class: ERB::Compiler::Buffer
- Inherits:
-
Object
- Object
- ERB::Compiler::Buffer
- Defined in:
- lib/rubysl/erb/erb.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) ⇒ Buffer
constructor
A new instance of Buffer.
- #push(cmd) ⇒ Object
Constructor Details
#initialize(compiler, enc = nil) ⇒ Buffer
Returns a new instance of Buffer.
547 548 549 550 551 552 553 554 |
# File 'lib/rubysl/erb/erb.rb', line 547 def initialize(compiler, enc=nil) @compiler = compiler @line = [] @script = enc ? "#coding:#{enc.to_s}\n" : "" @compiler.pre_cmd.each do |x| push(x) end end |
Instance Attribute Details
#script ⇒ Object (readonly)
Returns the value of attribute script.
555 556 557 |
# File 'lib/rubysl/erb/erb.rb', line 555 def script @script end |
Instance Method Details
#close ⇒ Object
567 568 569 570 571 572 573 574 |
# File 'lib/rubysl/erb/erb.rb', line 567 def close return unless @line @compiler.post_cmd.each do |x| push(x) end @script << (@line.join('; ')) @line = nil end |
#cr ⇒ Object
561 562 563 564 565 |
# File 'lib/rubysl/erb/erb.rb', line 561 def cr @script << (@line.join('; ')) @line = [] @script << "\n" end |
#push(cmd) ⇒ Object
557 558 559 |
# File 'lib/rubysl/erb/erb.rb', line 557 def push(cmd) @line << cmd end |