Class: Infoboxer::Tree::Var

Inherits:
Compound show all
Defined in:
lib/infoboxer/tree/template.rb

Overview

Template variable.

It's basically the thing with name and ANY nodes inside, can be seen only as a direct child of Template.

Instance Attribute Summary collapse

Attributes inherited from Compound

#children

Attributes inherited from Node

#params, #parent

Instance Method Summary collapse

Methods inherited from Compound

#index_of, #text, #to_tree

Methods inherited from Node

#==, #children, coder, def_readers, #first?, #index, #inspect, #next_siblings, #prev_siblings, #siblings, #text, #text_, #to_s, #to_tree

Methods included from Navigation::Wikipath

#wikipath

Methods included from Navigation::Sections::Node

#in_sections

Methods included from Navigation::Shortcuts::Node

#bold?, #categories, #external_links, #heading?, #headings, #images, #infobox, #infoboxes, #italic?, #lists, #paragraphs, #tables, #templates, #wikilinks

Methods included from Navigation::Lookup::Node

#_lookup, #_lookup_children, #_lookup_next_siblings, #_lookup_parents, #_lookup_prev_sibling, #_lookup_prev_siblings, #_lookup_siblings, #_matches?, #lookup, #lookup_children, #lookup_next_siblings, #lookup_parents, #lookup_prev_sibling, #lookup_prev_siblings, #lookup_siblings, #matches?, #parent?

Constructor Details

#initialize(name, children = Nodes[]) ⇒ Var

Returns a new instance of Var.



14
15
16
17
# File 'lib/infoboxer/tree/template.rb', line 14

def initialize(name, children = Nodes[])
  super(children)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/infoboxer/tree/template.rb', line 12

def name
  @name
end

Instance Method Details

#empty?Boolean

Internal, used by Parser Means even children-less Var should not be removed from parser tree.

Returns:

  • (Boolean)


21
22
23
# File 'lib/infoboxer/tree/template.rb', line 21

def empty?
  false
end

#named?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/infoboxer/tree/template.rb', line 25

def named?
  name !~ /^\d+$/
end