class AdHocTemplate::Parser::TagType

Constants

PREDEFINED

Attributes

head[R]
head_of[R]
strip_iteration_indent[R]
tail[R]
tail_of[R]
token_pat[R]

Public Class Methods

[](tag_name) click to toggle source
# File lib/ad_hoc_template/parser.rb, line 197
def self.[](tag_name)
  @types[tag_name]
end
new(tag, iteration_tag, fallback_tag, strip_iteration_indent) click to toggle source
# File lib/ad_hoc_template/parser.rb, line 207
def initialize(tag, iteration_tag, fallback_tag, strip_iteration_indent)
  assign_type(tag, iteration_tag, fallback_tag)
  @token_pat = PseudoHiki.compile_token_pat(@head.keys, @tail.keys)
  @strip_iteration_indent = strip_iteration_indent
end
register(tag_name, tag, iteration_tag, fallback_tag, strip_iteration_indent=false) click to toggle source
# File lib/ad_hoc_template/parser.rb, line 201
def self.register(tag_name, tag, iteration_tag,
                  fallback_tag, strip_iteration_indent=false)
  @types[tag_name] = new(tag, iteration_tag,
                         fallback_tag, strip_iteration_indent)
end

Public Instance Methods

assign_type(tag, iteration_tag, fallback_tag) click to toggle source
# File lib/ad_hoc_template/parser.rb, line 213
def assign_type(tag, iteration_tag, fallback_tag)
  node_tag_pairs = [
    [ValueNode, *tag],
    [IterationNode, *iteration_tag],
    [FallbackNode, *fallback_tag],
  ]

  @head, @tail, @head_of, @tail_of = map_nodes_to_tags(node_tag_pairs)
end

Private Instance Methods

map_nodes_to_tags(node_tag_pairs) click to toggle source
# File lib/ad_hoc_template/parser.rb, line 223
def map_nodes_to_tags(node_tag_pairs)
  PseudoHiki.associate_nodes_with_tags(node_tag_pairs)
end