Class: Protocol::Media::Type

Inherits:
Range
  • Object
show all
Defined in:
lib/protocol/media/type.rb

Overview

A concrete media type and its parameters.

Constant Summary

Constants inherited from Range

Range::MEDIA_TYPE, Range::PARAMETER, Range::QUOTED_STRING, Range::TOKEN

Instance Attribute Summary

Attributes inherited from Range

#The subtype, e.g. `plain` or `*`., #The top-level type, e.g. `text` or `*`., #parameters, #subtype, #type

Instance Method Summary collapse

Methods inherited from Range

#==, #The media range parameters.=, for, #hash, #match?, #name, parse, parse_parameters, #to_s, unquote

Constructor Details

#initialize(type, subtype, parameters = {}) ⇒ Type

Returns a new instance of Type.



16
17
18
19
20
21
22
# File 'lib/protocol/media/type.rb', line 16

def initialize(type, subtype, parameters = {})
	if type.include?("*") || subtype.include?("*")
		raise ArgumentError, "Media types cannot contain wildcards: #{type}/#{subtype}"
	end
	
	super
end