Class: AdHocTemplate::Parser::TagNode

Inherits:
Parser::Node
  • Object
show all
Defined in:
lib/ad_hoc_template/parser.rb

Direct Known Subclasses

IterationTagNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#contains_any_value_assigned_tag_node?(record) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ad_hoc_template/parser.rb', line 31

def contains_any_value_assigned_tag_node?(record)
  self.select {|n| n.kind_of?(TagNode) }.each do |node|
    if node.kind_of? IterationTagNode
      return true if any_value_assigned_to_iteration_tag?(node, record)
    else
      val = record[node.join.strip]
      return true if val and not val.empty?
    end
  end
  false
end

#push(node = TreeStack::Node.new) ⇒ Object



11
12
13
14
# File 'lib/ad_hoc_template/parser.rb', line 11

def push(node=TreeStack::Node.new)
  node[0] = assign_type(node[0]) if self.empty?
  super
end