class Sinatra::Request::AcceptEntry

Attributes

entry[R]
params[RW]

Public Class Methods

new(entry) click to toggle source
    # File lib/sinatra/base.rb
 98 def initialize(entry)
 99   params = entry.scan(HEADER_PARAM).map! do |s|
100     key, value = s.strip.split('=', 2)
101     value = value[1..-2].gsub(/\\(.)/, '\1') if value.start_with?('"')
102     [key, value]
103   end
104 
105   @entry  = entry
106   @type   = entry[/[^;]+/].delete(' ')
107   @params = params.to_h
108   @q      = @params.delete('q') { 1.0 }.to_f
109 end

Public Instance Methods

<=>(other) click to toggle source
    # File lib/sinatra/base.rb
111 def <=>(other)
112   other.priority <=> priority
113 end
method_missing(*args, &block) click to toggle source
    # File lib/sinatra/base.rb
132 def method_missing(*args, &block)
133   to_str.send(*args, &block)
134 end
priority() click to toggle source
    # File lib/sinatra/base.rb
115 def priority
116   # We sort in descending order; better matches should be higher.
117   [@q, -@type.count('*'), @params.size]
118 end
respond_to?(*args) click to toggle source
Calls superclass method
    # File lib/sinatra/base.rb
128 def respond_to?(*args)
129   super || to_str.respond_to?(*args)
130 end
to_s(full = false) click to toggle source
    # File lib/sinatra/base.rb
124 def to_s(full = false)
125   full ? entry : to_str
126 end
to_str() click to toggle source
    # File lib/sinatra/base.rb
120 def to_str
121   @type
122 end