Class: Mime::Type::AcceptItem
- Inherits:
 - 
      Object
      
        
- Object
 - Mime::Type::AcceptItem
 
 
- Defined in:
 - lib/action_dispatch/http/mime_type.rb
 
Overview
A simple helper class used in parsing the accept header.
Instance Attribute Summary collapse
- 
  
    
      #index  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
:nodoc:.
 - 
  
    
      #name  ⇒ Object 
    
    
      (also: #to_s)
    
  
  
  
  
    
    
  
  
  
  
  
  
    
:nodoc:.
 - 
  
    
      #q  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
:nodoc:.
 
Instance Method Summary collapse
- #<=>(item) ⇒ Object
 - 
  
    
      #initialize(index, name, q = nil)  ⇒ AcceptItem 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of AcceptItem.
 
Constructor Details
#initialize(index, name, q = nil) ⇒ AcceptItem
Returns a new instance of AcceptItem.
      91 92 93 94 95 96  | 
    
      # File 'lib/action_dispatch/http/mime_type.rb', line 91 def initialize(index, name, q = nil) @index = index @name = name q ||= 0.0 if @name == "*/*" # Default wildcard match to end of list. @q = ((q || 1.0).to_f * 100).to_i end  | 
  
Instance Attribute Details
#index ⇒ Object
:nodoc:
      88 89 90  | 
    
      # File 'lib/action_dispatch/http/mime_type.rb', line 88 def index @index end  | 
  
#name ⇒ Object Also known as: to_s
:nodoc:
      88 89 90  | 
    
      # File 'lib/action_dispatch/http/mime_type.rb', line 88 def name @name end  | 
  
#q ⇒ Object
:nodoc:
      88 89 90  | 
    
      # File 'lib/action_dispatch/http/mime_type.rb', line 88 def q @q end  | 
  
Instance Method Details
#<=>(item) ⇒ Object
      98 99 100 101 102  | 
    
      # File 'lib/action_dispatch/http/mime_type.rb', line 98 def <=>(item) result = item.q <=> @q result = @index <=> item.index if result == 0 result end  |