class Sinatra::Request::AcceptEntry
Attributes
Public Class Methods
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 = params.to_h 100 @q = @params.delete('q') { 1.0 }.to_f 101 end
Public Instance Methods
Source
# File lib/sinatra/base.rb 103 def <=>(other) 104 other.priority <=> priority 105 end
Source
# File lib/sinatra/base.rb 124 def method_missing(*args, &block) 125 to_str.send(*args, &block) 126 end
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
Source
# File lib/sinatra/base.rb 120 def respond_to?(*args) 121 super || to_str.respond_to?(*args) 122 end
Calls superclass method
Source
# File lib/sinatra/base.rb 116 def to_s(full = false) 117 full ? entry : to_str 118 end