Class: DocTemplate::Template::TagRegistry
- Inherits:
-
Object
- Object
- DocTemplate::Template::TagRegistry
- Includes:
- Enumerable
- Defined in:
- lib/doc_template/template.rb
Instance Method Summary collapse
-
#[](tag_name) ⇒ Object
returns the default tag if the tag is unknown.
- #[]=(tag_name, klass) ⇒ Object
-
#initialize ⇒ TagRegistry
constructor
A new instance of TagRegistry.
- #keys ⇒ Object
Constructor Details
#initialize ⇒ TagRegistry
Returns a new instance of TagRegistry.
9 10 11 |
# File 'lib/doc_template/template.rb', line 9 def initialize @tags = {} end |
Instance Method Details
#[](tag_name) ⇒ Object
returns the default tag if the tag is unknown
14 15 16 17 |
# File 'lib/doc_template/template.rb', line 14 def [](tag_name) tag_to_load = @tags.key?(tag_name) ? tag_name : 'default' @tags[tag_to_load] end |
#[]=(tag_name, klass) ⇒ Object
19 20 21 |
# File 'lib/doc_template/template.rb', line 19 def []=(tag_name, klass) @tags[tag_name] = klass end |
#keys ⇒ Object
23 24 25 |
# File 'lib/doc_template/template.rb', line 23 def keys @tags.keys end |