class HTTPX::ContentType

  1. lib/httpx/response.rb
Superclass: Object

Methods

Public Class

  1. new
  2. parse

Public Instance

  1. charset
  2. mime_type

Constants

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

Attributes

charset [R]
mime_type [R]

Public Class methods

new (mime_type, charset)
[show source]
    # File lib/httpx/response.rb
211 def initialize(mime_type, charset)
212   @mime_type = mime_type
213   @charset = charset
214 end
parse (str)

Parse string and return ContentType struct

[show source]
    # File lib/httpx/response.rb
218 def parse(str)
219   new(mime_type(str), charset(str))
220 end