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