class Sinatra::Request::AcceptEntry
Attributes
Public Class Methods
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
Source
# File lib/sinatra/base.rb 111 def <=>(other) 112 other.priority <=> priority 113 end
Source
# File lib/sinatra/base.rb 132 def method_missing(*args, &block) 133 to_str.send(*args, &block) 134 end
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
Source
# File lib/sinatra/base.rb 128 def respond_to?(*args) 129 super || to_str.respond_to?(*args) 130 end
Calls superclass method
Source
# File lib/sinatra/base.rb 124 def to_s(full = false) 125 full ? entry : to_str 126 end