[Groonga-commit] droonga/fluent-plugin-droonga at bb3e7ba [master] Fix class name

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Mar 21 15:27:45 JST 2014


Kouhei Sutou	2014-03-21 15:27:45 +0900 (Fri, 21 Mar 2014)

  New Revision: bb3e7ba88bc4b01a12a794b0fd55ea57d6f0d0cf
  https://github.com/droonga/fluent-plugin-droonga/commit/bb3e7ba88bc4b01a12a794b0fd55ea57d6f0d0cf

  Message:
    Fix class name
    
    "replicas" is a collection of volume, not a collection of replica.

  Modified files:
    lib/droonga/catalog/dataset.rb
    test/unit/catalog/test_dataset.rb
  Renamed files:
    lib/droonga/catalog/volume_collection.rb
      (from lib/droonga/catalog/replica_collection.rb)
    test/unit/catalog/test_volume_collection.rb
      (from test/unit/catalog/test_replica_collection.rb)

  Modified: lib/droonga/catalog/dataset.rb (+2 -2)
===================================================================
--- lib/droonga/catalog/dataset.rb    2014-03-21 15:11:38 +0900 (3e670a7)
+++ lib/droonga/catalog/dataset.rb    2014-03-21 15:27:45 +0900 (55c14bd)
@@ -14,7 +14,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require "droonga/catalog/schema"
-require "droonga/catalog/replica_collection"
+require "droonga/catalog/volume_collection"
 
 module Droonga
   module Catalog
@@ -52,7 +52,7 @@ module Droonga
       end
 
       def replicas
-        @replicas ||= ReplicaCollection.new(@data["replicas"])
+        @replicas ||= VolumeCollection.new(@data["replicas"])
       end
     end
   end

  Renamed: lib/droonga/catalog/volume_collection.rb (+7 -7) 85%
===================================================================
--- lib/droonga/catalog/replica_collection.rb    2014-03-21 15:11:38 +0900 (b7eafca)
+++ lib/droonga/catalog/volume_collection.rb    2014-03-21 15:27:45 +0900 (478e782)
@@ -15,15 +15,15 @@
 
 module Droonga
   module Catalog
-    class ReplicaCollection
+    class VolumeCollection
       include Enumerable
 
-      def initialize(replicas)
-        @replicas = replicas
+      def initialize(volumes)
+        @volumes = volumes
       end
 
       def each(&block)
-        @replicas.each(&block)
+        @volumes.each(&block)
       end
 
       def ==(other)
@@ -42,11 +42,11 @@ module Droonga
       def select(how=nil)
         case how
         when :top
-          [@replicas.first]
+          [@volumes.first]
         when :random
-          [@replicas.sample]
+          [@volumes.sample]
         when :all
-          @replicas
+          @volumes
         else
           super
         end

  Modified: test/unit/catalog/test_dataset.rb (+1 -1)
===================================================================
--- test/unit/catalog/test_dataset.rb    2014-03-21 15:11:38 +0900 (87cab44)
+++ test/unit/catalog/test_dataset.rb    2014-03-21 15:27:45 +0900 (2551d88)
@@ -90,7 +90,7 @@ class CatalogDatasetTest < Test::Unit::TestCase
         "replicas" => [],
       }
       dataset = create_dataset(data)
-      assert_equal(Droonga::Catalog::ReplicaCollection.new([]),
+      assert_equal(Droonga::Catalog::VolumeCollection.new([]),
                    dataset.replicas)
     end
   end

  Renamed: test/unit/catalog/test_volume_collection.rb (+14 -14) 59%
===================================================================
--- test/unit/catalog/test_replica_collection.rb    2014-03-21 15:11:38 +0900 (e70761e)
+++ test/unit/catalog/test_volume_collection.rb    2014-03-21 15:27:45 +0900 (4bc1c20)
@@ -13,37 +13,37 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-require "droonga/catalog/replica_collection"
+require "droonga/catalog/volume_collection"
 
-class CatalogReplicaCollectionTest < Test::Unit::TestCase
+class CatalogVolumeCollectionTest < Test::Unit::TestCase
   private
-  def create_replica_collection(replicas)
-    Droonga::Catalog::ReplicaCollection.new(replicas)
+  def create_volume_collection(volumes)
+    Droonga::Catalog::VolumeCollection.new(volumes)
   end
 
   class SelectTest < self
     def setup
-      replicas = [
-        "replica1",
-        "replica2",
-        "replica3",
+      volumes = [
+        "volume1",
+        "volume2",
+        "volume3",
       ]
-      @collection = create_replica_collection(replicas)
+      @collection = create_volume_collection(volumes)
     end
 
     def test_top
-      assert_equal(["replica1"], @collection.select(:top))
+      assert_equal(["volume1"], @collection.select(:top))
     end
 
     def test_random
-      random_replicas =****@colle*****(:random).collect do |replica|
-        replica.gsub(/\Areplica[123]\z/, "any replica")
+      random_volumes =****@colle*****(:random).collect do |volume|
+        volume.gsub(/\Avolume[123]\z/, "any volume")
       end
-      assert_equal(["any replica"], random_replicas)
+      assert_equal(["any volume"], random_volumes)
     end
 
     def test_all
-      assert_equal(["replica1", "replica2", "replica3"],
+      assert_equal(["volume1", "volume2", "volume3"],
                    @collection.select(:all))
     end
   end
-------------- next part --------------
HTML����������������������������...
Download 



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