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
Instance Method Summary collapse
-
#call(name, node) ⇒ Node
The node which should be used to render the named tag.
- #freeze ⇒ Object
- #tag(name, klass = nil, &block) ⇒ Object
Instance Attribute Details
#named ⇒ Object (readonly)
Returns the value of attribute named.
16 17 18 |
# File 'lib/utopia/content/namespace.rb', line 16 def named @named end |
Class Method Details
.extended(other) ⇒ Object
10 11 12 13 14 |
# File 'lib/utopia/content/namespace.rb', line 10 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.
32 33 34 |
# File 'lib/utopia/content/namespace.rb', line 32 def call(name, node) @named[name] end |
#freeze ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/utopia/content/namespace.rb', line 18 def freeze return self if frozen? @named.freeze @named.values.each(&:freeze) super end |
#tag(name, klass = nil, &block) ⇒ Object
27 28 29 |
# File 'lib/utopia/content/namespace.rb', line 27 def tag(name, klass = nil, &block) @named[name] = klass || block end |