# File lib/sinatra/base.rb, line 72 def initialize(entry) params = entry.scan(HEADER_PARAM).map do |s| key, value = s.strip.split('=', 2) value = value[1..-2].gsub(/\(.)/, '\1') if value.start_with?('"') [key, value] end @entry = entry @type = entry[/[^;]+/].delete(' ') @params = Hash[params] @q = @params.delete('q') { "1.0" }.to_f end
# File lib/sinatra/base.rb, line 85 def <=>(other) other.priority <=> self.priority end
# File lib/sinatra/base.rb, line 106 def method_missing(*args, &block) to_str.send(*args, &block) end
# File lib/sinatra/base.rb, line 89 def priority # We sort in descending order; better matches should be higher. [ @q, -@type.count('*'), @params.size ] end
# File lib/sinatra/base.rb, line 102 def respond_to?(*args) super or to_str.respond_to?(*args) end
# File lib/sinatra/base.rb, line 98 def to_s(full = false) full ? entry : to_str end
# File lib/sinatra/base.rb, line 94 def to_str @type end