Class: Haml::Compiler::ChildrenCompiler
- Inherits:
-
Object
- Object
- Haml::Compiler::ChildrenCompiler
- Defined in:
- lib/haml/compiler/children_compiler.rb
Instance Method Summary collapse
- #compile(node, &block) ⇒ Object
-
#initialize ⇒ ChildrenCompiler
constructor
A new instance of ChildrenCompiler.
Constructor Details
#initialize ⇒ ChildrenCompiler
Returns a new instance of ChildrenCompiler.
7 8 9 |
# File 'lib/haml/compiler/children_compiler.rb', line 7 def initialize @lineno = 1 end |
Instance Method Details
#compile(node, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/haml/compiler/children_compiler.rb', line 11 def compile(node, &block) temple = [:multi] return temple if node.children.empty? temple << :whitespace if prepend_whitespace?(node) node.children.each do |n| rstrip_whitespace!(temple) if nuke_prev_whitespace?(n) insert_newlines!(temple, n) temple << moving_lineno(n) { block.call(n) } temple << :whitespace if insert_whitespace?(n) end rstrip_whitespace!(temple) if nuke_inner_whitespace?(node) confirm_whitespace(temple) end |