Class: DocTemplate::Template::TagRegistry

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/doc_template/template.rb

Instance Method Summary collapse

Constructor Details

#initializeTagRegistry

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

#keysObject



23
24
25
# File 'lib/doc_template/template.rb', line 23

def keys
  @tags.keys
end