class Sinatra::Request::AcceptEntry
Attributes
entry[R]
params[RW]
Public Class Methods
new(entry)
click to toggle source
# File lib/sinatra/base.rb 90 def initialize(entry) 91 params = entry.scan(HEADER_PARAM).map! do |s| 92 key, value = s.strip.split('=', 2) 93 value = value[1..-2].gsub(/\\(.)/, '\1') if value.start_with?('"') 94 [key, value] 95 end 96 97 @entry = entry 98 @type = entry[/[^;]+/].delete(' ') 99 @params = Hash[params] 100 @q = @params.delete('q') { 1.0 }.to_f 101 end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/sinatra/base.rb 103 def <=>(other) 104 other.priority <=> self.priority 105 end
method_missing(*args, &block)
click to toggle source
# File lib/sinatra/base.rb 124 def method_missing(*args, &block) 125 to_str.send(*args, &block) 126 end
priority()
click to toggle source
# File lib/sinatra/base.rb 107 def priority 108 # We sort in descending order; better matches should be higher. 109 [ @q, -@type.count('*'), @params.size ] 110 end
respond_to?(*args)
click to toggle source
Calls superclass method
# File lib/sinatra/base.rb 120 def respond_to?(*args) 121 super or to_str.respond_to?(*args) 122 end
to_s(full = false)
click to toggle source
# File lib/sinatra/base.rb 116 def to_s(full = false) 117 full ? entry : to_str 118 end
to_str()
click to toggle source
# File lib/sinatra/base.rb 112 def to_str 113 @type 114 end