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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#namedObject (readonly)

Returns the value of attribute named.



33
34
35
# File 'lib/utopia/content/namespace.rb', line 33

def named
  @named
end

Class Method Details

.extended(other) ⇒ Object



27
28
29
30
31
# File 'lib/utopia/content/namespace.rb', line 27

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.

Returns:

  • (Node)

    The node which should be used to render the named tag.



49
50
51
# File 'lib/utopia/content/namespace.rb', line 49

def call(name, node)
	@named[name]
end

#freezeObject



35
36
37
38
39
40
41
42
# File 'lib/utopia/content/namespace.rb', line 35

def freeze
	return self if frozen?
	
	@named.freeze
	@named.values.each(&:freeze)
	
	super
end

#tag(name, klass = nil, &block) ⇒ Object



44
45
46
# File 'lib/utopia/content/namespace.rb', line 44

def tag(name, klass = nil, &block)
	@named[name] = klass || block
end