class HtmlTemplate::Names

Public Class Methods

new() click to toggle source
# File lib/html/template.rb, line 237
def initialize
  @names = Hash.new
end

Public Instance Methods

add( scope, ident, tag ) click to toggle source
# File lib/html/template.rb, line 243
def add( scope, ident, tag )
  ## e.g. scope e.g. ['feeds'] or ['feeds','items'] - is a stack / array
  ##      ident e.g.  title                         - is a string
  ##      tag   e.g.  $VAR/$LOOP/$IF/$UNLESS        - is a string
  h = fetch( scope, ident )
  h[ tag ] ||= 0
  h[ tag ] += 1
end
to_h() click to toggle source
# File lib/html/template.rb, line 241
def to_h() @names; end

Private Instance Methods

fetch( scope, ident ) click to toggle source
# File lib/html/template.rb, line 253
def fetch( scope, ident )
  ## fetch name in scoped hierarchy
  ##   if first time than setup new empty hash
  h = @names
  scope.each do |name|
    h = h[name] ||= {}
  end
  h[ ident ] ||= {}
end