[Groonga-commit] droonga/droonga-engine at 042c357 [buffered-forward] Make Droonga::Address subclass of Droonga::NodeName

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Mar 25 10:21:30 JST 2015


YUKI Hiroshi	2015-03-25 10:21:30 +0900 (Wed, 25 Mar 2015)

  New Revision: 042c3578c757d6ebf281ca080aed9970b64b4699
  https://github.com/droonga/droonga-engine/commit/042c3578c757d6ebf281ca080aed9970b64b4699

  Message:
    Make Droonga::Address subclass of Droonga::NodeName

  Modified files:
    lib/droonga/address.rb
    lib/droonga/node_name.rb

  Modified: lib/droonga/address.rb (+4 -20)
===================================================================
--- lib/droonga/address.rb    2015-03-25 00:17:56 +0900 (89e8f33)
+++ lib/droonga/address.rb    2015-03-25 10:21:30 +0900 (34acf5d)
@@ -16,7 +16,7 @@
 require "droonga/node_name"
 
 module Droonga
-  class Address
+  class Address < NodeName
     class << self
       def parse(string)
         if /\A(.+):(\d+)\/([^.]+)(?:\.(.+))?\z/ =~ string
@@ -37,38 +37,22 @@ module Droonga
 
     attr_reader :name
     def initialize(components={})
-      @node = NodeName.new(components)
+      super
       @name = components[:name]
     end
 
-    def host
-      @node.host
-    end
-
-    def port
-      @node.port
-    end
-
-    def tag
-      @node.tag
-    end
-
     def to_s
-      string = node
+      string = super
       string << ".#{@name}" if @name
       string
     end
 
     def to_a
-      @node.to_a + [@name]
+      super + [@name]
     end
 
     def ==(other)
       other.is_a?(self.class) and to_a == other.to_a
     end
-
-    def node
-      @node.to_s
-    end
   end
 end

  Modified: lib/droonga/node_name.rb (+4 -0)
===================================================================
--- lib/droonga/node_name.rb    2015-03-25 00:17:56 +0900 (7abc6b6)
+++ lib/droonga/node_name.rb    2015-03-25 10:21:30 +0900 (2b4e09b)
@@ -58,6 +58,10 @@ module Droonga
     end
 
     def to_s
+      node
+    end
+
+    def node
       "#{@host}:#{@port}/#{@tag}"
     end
 
-------------- next part --------------
HTML����������������������������...
Download 



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