[Groonga-commit] droonga/droonga-engine at 17fd042 [master] Don't assign to a variable with a name same to another method

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Aug 28 19:43:29 JST 2014


YUKI Hiroshi	2014-08-28 19:43:29 +0900 (Thu, 28 Aug 2014)

  New Revision: 17fd04252f425cc7042574c114a80732fcd0be95
  https://github.com/droonga/droonga-engine/commit/17fd04252f425cc7042574c114a80732fcd0be95

  Message:
    Don't assign to a variable with a name same to another method

  Modified files:
    lib/droonga/command/remote.rb

  Modified: lib/droonga/command/remote.rb (+8 -11)
===================================================================
--- lib/droonga/command/remote.rb    2014-08-28 19:31:36 +0900 (7ba99e2)
+++ lib/droonga/command/remote.rb    2014-08-28 19:43:29 +0900 (2b15e63)
@@ -285,8 +285,7 @@ module Droonga
 
       class SetReplicas < ModifyReplicasBase
         def process
-          return unless dataset
-          return unless hosts
+          return if dataset.nil? or hosts.nil?
 
           log("new replicas: #{hosts.join(",")}")
 
@@ -301,27 +300,25 @@ module Droonga
 
       class AddReplicas < ModifyReplicasBase
         def process
-          return unless dataset
-          return unless hosts
+          return if dataset.nil? or hosts.nil?
 
-          hosts -= [host]
-          return if hosts.empty?
+          added_hosts -= [host]
+          return if added_hosts.empty?
 
-          log("adding replicas: #{hosts.join(",")}")
+          log("adding replicas: #{added_hosts.join(",")}")
 
           CatalogModifier.modify do |modifier|
-            modifier.datasets[dataset].replicas.hosts += hosts
+            modifier.datasets[dataset].replicas.hosts += added_hosts
             modifier.datasets[dataset].replicas.hosts.uniq!
           end
 
-          Serf.join(@serf_name, *hosts)
+          Serf.join(@serf_name, *added_hosts)
         end
       end
 
       class RemoveReplicas < ModifyReplicasBase
         def process
-          return unless dataset
-          return unless hosts
+          return if dataset.nil? or hosts.nil?
 
           log("removing replicas: #{hosts.join(",")}")
 
-------------- next part --------------
HTML����������������������������...
Download 



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