Module: Utopia::Content::Namespace
- Included in:
- Tags
- Defined in:
- lib/utopia/content/namespace.rb
Overview
A namespace which contains tags which can be rendered within a Document.
Instance Attribute Summary collapse
-
#named ⇒ Object
readonly
Returns the value of attribute named.
Class Method Summary collapse
-
.extended(other) ⇒ Object
Initialize tag mappings on an extended namespace.
Instance Method Summary collapse
-
#call(name, node) ⇒ Node
The node which should be used to render the named tag.
-
#freeze ⇒ Object
Freeze this object and its internal state.
-
#tag(name, klass = nil, &block) ⇒ Object
Tag.
Instance Attribute Details
#named ⇒ Object (readonly)
Returns the value of attribute named.
19 20 21 |
# File 'lib/utopia/content/namespace.rb', line 19 def named @named end |
Class Method Details
.extended(other) ⇒ Object
Initialize tag mappings on an extended namespace.
13 14 15 16 17 |
# File 'lib/utopia/content/namespace.rb', line 13 def self.extended(other) other.class_exec do @named = {} end end |
Instance Method Details
#call(name, node) ⇒ Node
Returns The node which should be used to render the named tag.
41 42 43 |
# File 'lib/utopia/content/namespace.rb', line 41 def call(name, node) @named[name] end |
#freeze ⇒ Object
Freeze this object and its internal state.
23 24 25 26 27 28 29 30 |
# File 'lib/utopia/content/namespace.rb', line 23 def freeze return self if frozen? @named.freeze @named.values.each(&:freeze) super end |
#tag(name, klass = nil, &block) ⇒ Object
Tag.
36 37 38 |
# File 'lib/utopia/content/namespace.rb', line 36 def tag(name, klass = nil, &block) @named[name] = klass || block end |