Class: HTTP::Accept::ContentType
- Inherits:
-
MediaTypes::MediaRange
- Object
- Struct
- MediaTypes::MediaRange
- HTTP::Accept::ContentType
- Defined in:
- lib/http/accept/content_type.rb
Overview
A content type is different from a media range, in that a content type should not have any wild cards.
Instance Attribute Summary
Attributes inherited from MediaTypes::MediaRange
Instance Method Summary collapse
-
#initialize(type, subtype, parameters = {}) ⇒ ContentType
constructor
A new instance of ContentType.
Methods inherited from MediaTypes::MediaRange
#===, #mime_type, #parameters_string, parse, parse_parameters, #quality_factor, #split, #to_s
Constructor Details
#initialize(type, subtype, parameters = {}) ⇒ ContentType
Returns a new instance of ContentType.
13 14 15 16 17 18 |
# File 'lib/http/accept/content_type.rb', line 13 def initialize(type, subtype, parameters = {}) # We do some basic validation here: raise ArgumentError.new("#{self.class} can not have wildcards: #{type}", "#{subtype}") if type.include?('*') || subtype.include?('*') super end |