Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:29:39 JST 2016
Kouhei Sutou 2014-10-02 20:50:53 +0900 (Thu, 02 Oct 2014) New Revision: 38cb6e259f03975788e3881264c5f6ec0a84e67f https://github.com/groonga/groonga-command/commit/38cb6e259f03975788e3881264c5f6ec0a84e67f Message: Add "path_" prefix Because "prefix" is too general for Command::Base. Modified files: lib/groonga/command/base.rb lib/groonga/command/format/uri.rb test/command/test-base.rb Modified: lib/groonga/command/base.rb (+4 -4) =================================================================== --- lib/groonga/command/base.rb 2014-10-02 20:47:07 +0900 (c5b4a97) +++ lib/groonga/command/base.rb 2014-10-02 20:50:53 +0900 (f660c1b) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012-2013 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2012-2014 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -40,13 +40,13 @@ module Groonga end attr_reader :name, :arguments - attr_accessor :original_format, :original_source, :prefix + attr_accessor :original_format, :original_source, :path_prefix def initialize(name, pair_arguments, ordered_arguments=[]) @name = name @arguments = construct_arguments(pair_arguments, ordered_arguments) @original_format = nil @original_source = nil - @prefix = "d" + @path_prefix = "/d/" end def [](name) @@ -81,7 +81,7 @@ module Groonga end def to_uri_format - Format::URI.new(@prefix, @name, normalized_arguments).path + Format::URI.new(@path_prefix, @name, normalized_arguments).path end def to_command_format Modified: lib/groonga/command/format/uri.rb (+4 -4) =================================================================== --- lib/groonga/command/format/uri.rb 2014-10-02 20:47:07 +0900 (6590c91) +++ lib/groonga/command/format/uri.rb 2014-10-02 20:50:53 +0900 (0e4c853) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012-2013 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2012-2014 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,14 +22,14 @@ module Groonga module Command module Format class URI - def initialize(prefix, name, arguments) - @prefix = prefix + def initialize(path_prefix, name, arguments) + @path_prefix = path_prefix @name = name @arguments = arguments end def path - path = "/#{@prefix}/#{@name}" + path = [@path_prefix.chomp("/"), @name].join("/") arguments =****@argum***** output_type = arguments.delete(:output_type) path << ".#{output_type}" if output_type Modified: test/command/test-base.rb (+3 -3) =================================================================== --- test/command/test-base.rb 2014-10-02 20:47:07 +0900 (08e9fe6) +++ test/command/test-base.rb 2014-10-02 20:50:53 +0900 (9fb9801) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2011-2013 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2011-2014 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -58,11 +58,11 @@ class BaseCommandTest < Test::Unit::TestCase select.to_uri_format) end - def test_prefix + def test_path_prefix select = Groonga::Command::Base.new("select", :table => "Users", :output_type => "json") - select.prefix = "db1" + select.path_prefix = "/db1" assert_equal("/db1/select.json?table=Users", select.to_uri_format) end -------------- next part -------------- HTML����������������������������... Télécharger