Class: HTTP::ContentType

Inherits:
Struct
  • Object
show all
Defined in:
lib/http/content_type.rb

Constant Summary collapse

MIME_TYPE_RE =
%r{^([^/]+/[^;]+)(?:$|;)}
CHARSET_RE =
/;\s*charset=([^;]+)/i

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#charsetObject

Returns the value of attribute charset

Returns:

  • (Object)

    the current value of charset



2
3
4
# File 'lib/http/content_type.rb', line 2

def charset
  @charset
end

#mime_typeObject

Returns the value of attribute mime_type

Returns:

  • (Object)

    the current value of mime_type



2
3
4
# File 'lib/http/content_type.rb', line 2

def mime_type
  @mime_type
end

Class Method Details

.parse(str) ⇒ Object

Parse string and return ContentType struct



8
9
10
# File 'lib/http/content_type.rb', line 8

def parse(str)
  new mime_type(str), charset(str)
end