Mixin for holding meta-information.
      Attributes
    
  
          
            Read & Write
          
        
      
          
            Read
          
        
      
          
            Read
          
        
      
      Instance Methods
    
  
          
            2.7
          
          
            View on GitHub
            
          
        
        
          
            # File tmp/rubies/ruby-2.7.6/lib/open-uri.rb, line 557
def charset
  type, *parameters = content_type_parse
  if pair = parameters.assoc('charset')
    pair.last.downcase
  elsif block_given?
    yield
  elsif type && %r{\Atext/} =~ type
    "utf-8" # RFC6838 4.2.1
  else
    nil
  end
end
          
        
      returns a charset parameter in Content-Type field. It is downcased for canonicalization.
If charset parameter is not given but a block is given, the block is called and its result is returned. It can be used to guess charset.
If charset parameter and block is not given, nil is returned except text type. In that case, “utf-8” is returned as defined by RFC6838 4.2.1
          
            2.7
          
          
            View on GitHub
            
          
        
        
          
            # File tmp/rubies/ruby-2.7.6/lib/open-uri.rb, line 574
def content_encoding
  vs = @metas['content-encoding']
  if vs && %r{\A#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?(?:,#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?)*}o =~ (v = vs.join(', '))
    v.scan(RE_TOKEN).map {|content_coding| content_coding.downcase}
  else
    []
  end
end
          
        
      Returns a list of encodings in Content-Encoding field as an array of strings.
The encodings are downcased for canonicalization.
          
            2.7
          
          
            View on GitHub
            
          
        
        
          
            # File tmp/rubies/ruby-2.7.6/lib/open-uri.rb, line 542
def content_type
  type, *_ = content_type_parse
  type || 'application/octet-stream'
end
          
        
      returns “type/subtype” which is MIME Content-Type. It is downcased for canonicalization. Content-Type parameters are stripped.
          
            2.7
          
          
            View on GitHub
            
          
        
        
          
            # File tmp/rubies/ruby-2.7.6/lib/open-uri.rb, line 504
def last_modified
  if vs = @metas['last-modified']
    v = vs.join(', ')
    Time.httpdate(v)
  else
    nil
  end
end
          
        
      returns a Time that represents the Last-Modified field.