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.



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

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

Instance Method Details

#compile(node, &block) ⇒ Object



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

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