Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:16:55 JST 2016
Kouhei Sutou 2012-11-25 17:24:40 +0900 (Sun, 25 Nov 2012) New Revision: 015fe5dd9a5c6d512e0b0b3d09989f69711b4c58 https://github.com/groonga/groonga-command/commit/015fe5dd9a5c6d512e0b0b3d09989f69711b4c58 Message: Fix wrong word parameter -> argument Modified files: lib/groonga/command/base.rb lib/groonga/command/parser.rb lib/groonga/command/select.rb Modified: lib/groonga/command/base.rb (+12 -12) =================================================================== --- lib/groonga/command/base.rb 2012-11-25 17:12:32 +0900 (a7e5ff8) +++ lib/groonga/command/base.rb 2012-11-25 17:24:40 +0900 (32e6c20) @@ -33,18 +33,18 @@ module Groonga end class Base - attr_reader :name, :parameters + attr_reader :name, :arguments attr_accessor :original_format - def initialize(name, parameters) + def initialize(name, arguments) @name = name - @parameters = parameters + @arguments = arguments @original_format = nil end def ==(other) other.is_a?(self.class) and @name == other.name and - @parameters == other.parameters + @arguments == other.arguments end def uri_format? @@ -57,28 +57,28 @@ module Groonga def to_uri_format path = "/d/#{@name}" - parameters =****@param***** - output_type = parameters.delete("output_type") + arguments =****@argum***** + output_type = arguments.delete("output_type") path << ".#{output_type}" if output_type - unless parameters.empty? - sorted_parameters = parameters.sort_by do |name, _| + unless arguments.empty? + sorted_arguments = arguments.sort_by do |name, _| name.to_s end - uri_parameters = sorted_parameters.collect do |name, value| + uri_arguments = sorted_arguments.collect do |name, value| "#{CGI.escape(name)}=#{CGI.escape(value)}" end path << "?" - path << uri_parameters.join("&") + path << uri_arguments.join("&") end path end def to_command_format command_line = [@name] - sorted_parameters =****@param*****_by do |name, _| + sorted_arguments =****@argum*****_by do |name, _| name.to_s end - sorted_parameters.each do |name, value| + sorted_arguments.each do |name, value| escaped_value = value.gsub(/[\n"\\]/) do special_character = $MATCH case special_character Modified: lib/groonga/command/parser.rb (+11 -11) =================================================================== --- lib/groonga/command/parser.rb 2012-11-25 17:12:32 +0900 (f48a237) +++ lib/groonga/command/parser.rb 2012-11-25 17:24:40 +0900 (f7790a5) @@ -44,31 +44,31 @@ module Groonga private def parse_uri_path(path) - name, parameters_string = path.split(/\?/, 2) - parameters = {} - if parameters_string - parameters_string.split(/&/).each do |parameter_string| - key, value = parameter_string.split(/\=/, 2) - parameters[key] = CGI.unescape(value) + name, arguments_string = path.split(/\?/, 2) + arguments = {} + if arguments_string + arguments_string.split(/&/).each do |argument_string| + key, value = argument_string.split(/\=/, 2) + arguments[key] = CGI.unescape(value) end end name = name.gsub(/\A\/d\//, '') name, output_type = name.split(/\./, 2) - parameters["output_type"] = output_type if output_type + arguments["output_type"] = output_type if output_type command_class = Command.find(name) - command = command_class.new(name, parameters) + command = command_class.new(name, arguments) command.original_format = :uri command end def parse_command_line(command_line) name, *options = Shellwords.shellwords(command_line) - parameters = {} + arguments = {} options.each_slice(2) do |key, value| - parameters[key.gsub(/\A--/, '')] = value + arguments[key.gsub(/\A--/, '')] = value end command_class = Command.find(name) - command = command_class.new(name, parameters) + command = command_class.new(name, arguments) command.original_format = :command command end Modified: lib/groonga/command/select.rb (+6 -6) =================================================================== --- lib/groonga/command/select.rb 2012-11-25 17:12:32 +0900 (31d4d23) +++ lib/groonga/command/select.rb 2012-11-25 17:24:40 +0900 (8e43d84) @@ -24,19 +24,19 @@ module Groonga Command.register("select", self) def sortby - @parameters["sortby"] + @arguments["sortby"] end def scorer - @parameters["scorer"] + @arguments["scorer"] end def query - @parameters["query"] + @arguments["query"] end def filter - @parameters["filter"] + @arguments["filter"] end def conditions @@ -49,11 +49,11 @@ module Groonga end def drilldowns - @drilldowns ||= (@parameters["drilldown"] || "").split(/\s*,\s*/) + @drilldowns ||= (@arguments["drilldown"] || "").split(/\s*,\s*/) end def output_columns - @parameters["output_columns"] + @arguments["output_columns"] end end end -------------- next part -------------- HTML����������������������������...Download