Class: Rack::Client::Parser::Base
- Inherits:
-
Object
- Object
- Rack::Client::Parser::Base
- Defined in:
- lib/rack/client/parser/base.rb
Constant Summary collapse
- CONTENT_TYPE =
%r'^([^/]+)/([^;]+)\s?(?:;\s?(.*))?$'
Class Method Summary collapse
- .content_type(type, subtype, *parameters) ⇒ Object
- .lookup(content_type) ⇒ Object
- .type_table ⇒ Object
Class Method Details
.content_type(type, subtype, *parameters) ⇒ Object
9 10 11 |
# File 'lib/rack/client/parser/base.rb', line 9 def self.content_type(type, subtype, *parameters) type_table[type][subtype][parameters] = self end |
.lookup(content_type) ⇒ Object
17 18 19 20 21 |
# File 'lib/rack/client/parser/base.rb', line 17 def self.lookup(content_type) type, subtype, *parameters = content_type.scan(CONTENT_TYPE).first type_table[type][subtype][parameters.compact] end |
.type_table ⇒ Object
13 14 15 |
# File 'lib/rack/client/parser/base.rb', line 13 def self.type_table @@type_table end |