Class: Hamlit::Compiler::TagCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/hamlit/compiler/tag_compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(identity, options) ⇒ TagCompiler

Returns a new instance of TagCompiler.


9
10
11
12
13
# File 'lib/hamlit/compiler/tag_compiler.rb', line 9

def initialize(identity, options)
  @autoclose = options[:autoclose]
  @identity  = identity
  @attribute_compiler = AttributeCompiler.new(identity, options)
end

Instance Method Details

#compile(node, &block) ⇒ Object


15
16
17
18
19
# File 'lib/hamlit/compiler/tag_compiler.rb', line 15

def compile(node, &block)
  attrs    = @attribute_compiler.compile(node)
  contents = compile_contents(node, &block)
  [:html, :tag, node.value[:name], attrs, contents]
end