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