[Groonga-commit] droonga/droonga-engine at 0651ea5 [master] Add Address#node

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Jul 19 21:29:12 JST 2014


Kouhei Sutou	2014-07-19 21:29:12 +0900 (Sat, 19 Jul 2014)

  New Revision: 0651ea56d33534fc09a452785492669080ada0fa
  https://github.com/droonga/droonga-engine/commit/0651ea56d33534fc09a452785492669080ada0fa

  Message:
    Add Address#node

  Modified files:
    lib/droonga/address.rb
    test/unit/test_address.rb

  Modified: lib/droonga/address.rb (+5 -1)
===================================================================
--- lib/droonga/address.rb    2014-07-19 21:15:35 +0900 (1e0a945)
+++ lib/droonga/address.rb    2014-07-19 21:29:12 +0900 (0052f0b)
@@ -49,7 +49,7 @@ module Droonga
     end
 
     def to_s
-      string = "#{@host}:#{@port}/#{@tag}"
+      string = node
       string << ".#{@name}" if @name
       string
     end
@@ -61,5 +61,9 @@ module Droonga
     def ==(other)
       other.is_a?(self.class) and to_a == other.to_a
     end
+
+    def node
+      "#{@host}:#{@port}/#{@tag}"
+    end
   end
 end

  Modified: test/unit/test_address.rb (+7 -0)
===================================================================
--- test/unit/test_address.rb    2014-07-19 21:15:35 +0900 (6d118fa)
+++ test/unit/test_address.rb    2014-07-19 21:29:12 +0900 (6f63a91)
@@ -43,4 +43,11 @@ class AddressTest < Test::Unit::TestCase
                    parse("192.168.0.1:2929/droonga"))
     end
   end
+
+  class FormatterTest < self
+    def test_node
+      assert_equal("192.168.0.1:2929/droonga",
+                   address("192.168.0.1", 2929, "droonga", "000").node)
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index