class AdHocTemplate::EntryFormatGenerator::LabelChecker
Attributes
labels[R]
Public Class Methods
new()
click to toggle source
# File lib/ad_hoc_template/entry_format_generator.rb, line 9 def initialize @labels = {} end
Public Instance Methods
visit(tree, memo)
click to toggle source
# 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
Private Instance Methods
visit_iteration_tag_node(tree, memo)
click to toggle source
# File lib/ad_hoc_template/entry_format_generator.rb, line 26 def visit_iteration_tag_node(tree, memo) sub_checker = self iteration_label = tree.type if iteration_label sub_checker = self.class.new @labels[iteration_label] = [sub_checker.labels] end tree.each {|node| node.accept(sub_checker, memo) } end