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