class Sinatra::Request::AcceptEntry

Attributes

entry[R]
params[RW]

Public Class Methods

new(entry) click to toggle source
   # File lib/sinatra/base.rb
87 def initialize(entry)
88   params = entry.scan(HEADER_PARAM).map! do |s|
89     key, value = s.strip.split('=', 2)
90     value = value[1..-2].gsub(/\\(.)/, '\1') if value.start_with?('"')
91     [key, value]
92   end
93 
94   @entry  = entry
95   @type   = entry[/[^;]+/].delete(' ')
96   @params = Hash[params]
97   @q      = @params.delete('q') { 1.0 }.to_f
98 end

Public Instance Methods

<=>(other) click to toggle source
    # File lib/sinatra/base.rb
100 def <=>(other)
101   other.priority <=> self.priority
102 end
method_missing(*args, &block) click to toggle source
    # File lib/sinatra/base.rb
121 def method_missing(*args, &block)
122   to_str.send(*args, &block)
123 end
priority() click to toggle source
    # File lib/sinatra/base.rb
104 def priority
105   # We sort in descending order; better matches should be higher.
106   [ @q, -@type.count('*'), @params.size ]
107 end
respond_to?(*args) click to toggle source
Calls superclass method
    # File lib/sinatra/base.rb
117 def respond_to?(*args)
118   super or to_str.respond_to?(*args)
119 end
to_s(full = false) click to toggle source
    # File lib/sinatra/base.rb
113 def to_s(full = false)
114   full ? entry : to_str
115 end
to_str() click to toggle source
    # File lib/sinatra/base.rb
109 def to_str
110   @type
111 end