class Groonga::Command::Format::URI
Public Class Methods
new(path_prefix, name, arguments)
click to toggle source
# File lib/groonga/command/format/uri.rb, line 24 def initialize(path_prefix, name, arguments) @path_prefix = path_prefix @name = name @arguments = arguments end
Public Instance Methods
path()
click to toggle source
# File lib/groonga/command/format/uri.rb, line 30 def path path = [@path_prefix.chomp("/"), @name].join("/") arguments = @arguments.dup output_type = arguments.delete(:output_type) path << ".#{output_type}" if output_type unless arguments.empty? sorted_arguments = arguments.sort_by do |name, _| name.to_s end uri_arguments = sorted_arguments.collect do |name, value| "#{CGI.escape(name.to_s)}=#{CGI.escape(value)}" end path << "?" path << uri_arguments.join("&") end path end