Sha256: 03a49211ae961ecbbb464e7a630878763aef949ac2f5a20eeee6704db7767c85

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

module Hypertemplate
  class Registry

    def initialize
      @media_types = {}
    end

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

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hypertemplate-1.2.2 lib/hypertemplate/registry.rb
hypertemplate-1.2.1 lib/hypertemplate/registry.rb
hypertemplate-1.2.0 lib/hypertemplate/registry.rb