Class: Hypertemplate::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/hypertemplate/registry.rb

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



4
5
6
# File 'lib/hypertemplate/registry.rb', line 4

def initialize
  @media_types = {}
end

Instance Method Details

#<<(handler) ⇒ Object



8
9
10
11
12
# File 'lib/hypertemplate/registry.rb', line 8

def <<(handler)
  handler.media_types.each do |type|
    @media_types[type] = handler
  end
end

#[](media_type) ⇒ Object



14
15
16
# File 'lib/hypertemplate/registry.rb', line 14

def [](media_type)
  @media_types[media_type[/^([^\s\;]+)/, 1]]
end

#[]=(media_type, handler) ⇒ Object



18
19
20
# File 'lib/hypertemplate/registry.rb', line 18

def []=(media_type, handler)
  @media_types[media_type] = handler
end