Class: PageTemplate::Namespace

Inherits:
Object
  • Object
show all
Includes:
NamespaceItem
Defined in:
lib/PageTemplate/parser.rb

Instance Attribute Summary

Attributes included from NamespaceItem

#object, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NamespaceItem

#clear, #delete, #get, #parser, #set, #true?

Constructor Details

#initialize(parent = nil, object = nil) ⇒ Namespace

Returns a new instance of Namespace.


169
170
171
172
173
# File 'lib/PageTemplate/parser.rb', line 169

def initialize(parent=nil,object=nil)
  @values = Hash.new
  @parent = parent
  @object = object
end

Class Method Details

.construct_from(arg) ⇒ Object

Create a new top-level Namespace with a Hash-like object


176
177
178
179
180
181
182
# File 'lib/PageTemplate/parser.rb', line 176

def Namespace.construct_from(arg)
  ns = Namespace.new()
  arg.each { |k, v|
    ns[k] = v
  }
  return ns
end