Class: ERB::HamlCompiler::Buffer
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, delimiter) ⇒ Buffer
constructor
A new instance of Buffer.
- #push(cmd) ⇒ Object
Constructor Details
#initialize(compiler, delimiter) ⇒ Buffer
Returns a new instance of Buffer.
5 6 7 8 9 10 11 12 13 |
# File 'lib/haml/herb.rb', line 5
def initialize(compiler, delimiter)
@compiler = compiler
@line = []
@script = ""
@delimiter = delimiter
@compiler.pre_cmd.each do |x|
push(x)
end
end
|
Instance Attribute Details
#script ⇒ Object (readonly)
Returns the value of attribute script.
14 15 16 |
# File 'lib/haml/herb.rb', line 14
def script
@script
end
|
Instance Method Details
#close ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/haml/herb.rb', line 26
def close
return unless @line
@compiler.post_cmd.each do |x|
push(x)
end
@script << (@line.join(@delimiter))
@line = nil
end
|
#cr ⇒ Object
20 21 22 23 24 |
# File 'lib/haml/herb.rb', line 20
def cr
@script << (@line.join(@delimiter))
@line = []
@script << @delimiter
end
|
#push(cmd) ⇒ Object
16 17 18 |
# File 'lib/haml/herb.rb', line 16
def push(cmd)
@line << cmd
end
|