Class: AdHocTemplate::EntryFormatGenerator::LabelChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/ad_hoc_template/entry_format_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLabelChecker

Returns a new instance of LabelChecker.



9
10
11
# File 'lib/ad_hoc_template/entry_format_generator.rb', line 9

def initialize
  @labels = {}
end

Instance Attribute Details

#labelsObject (readonly)

Returns the value of attribute labels.



8
9
10
# File 'lib/ad_hoc_template/entry_format_generator.rb', line 8

def labels
  @labels
end

Instance Method Details

#visit(tree, memo) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/ad_hoc_template/entry_format_generator.rb', line 13

def visit(tree, memo)
  case tree
  when Parser::IterationNode, Parser::FallbackNode
    visit_iteration_tag_node(tree, memo)
  when Parser::TagNode
    @labels[tree.join.strip] = nil
  when Parser::Node
    tree.each {|node| node.accept(self, memo) }
  end
end