[Groonga-commit] groonga/groonga-command at fcefc7b [master] Add Load#table

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Dec 12 14:31:30 JST 2017


Kouhei Sutou	2017-12-12 14:31:30 +0900 (Tue, 12 Dec 2017)

  New Revision: fcefc7b35783c312ea409b8ad2dfe94ee32adfb6
  https://github.com/groonga/groonga-command/commit/fcefc7b35783c312ea409b8ad2dfe94ee32adfb6

  Message:
    Add Load#table

  Modified files:
    lib/groonga/command/load.rb
    test/command/test-load.rb

  Modified: lib/groonga/command/load.rb (+10 -3)
===================================================================
--- lib/groonga/command/load.rb    2017-12-06 10:31:40 +0900 (85fb1bf)
+++ lib/groonga/command/load.rb    2017-12-12 14:31:30 +0900 (692dc4e)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2012-2017  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
@@ -43,14 +41,23 @@ module Groonga
 
       Command.register(command_name, self)
 
+      attr_writer :table
       attr_writer :values
       attr_writer :columns
       def initialize(*argumetns)
         super
+        @table = nil
         @values = nil
         @columns = nil
       end
 
+      # @return [String] The table name to be loaded.
+      #
+      # @since 1.3.5
+      def table
+        @table ||= self[:table]
+      end
+
       def values
         @values ||= parse_values(self[:values])
       end

  Modified: test/command/test-load.rb (+13 -3)
===================================================================
--- test/command/test-load.rb    2017-12-06 10:31:40 +0900 (ae820bc)
+++ test/command/test-load.rb    2017-12-12 14:31:30 +0900 (630c9a8)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2012-2017  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
@@ -56,6 +54,18 @@ class LoadCommandTest < Test::Unit::TestCase
     end
   end
 
+  class TableTest < self
+    def test_nil
+      command = load_command
+      assert_nil(command.table)
+    end
+
+    def test_specified
+      command = load_command(:table => "Users")
+      assert_equal("Users", command.table)
+    end
+  end
+
   class ValuesTest < self
     def test_nil
       command = load_command
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171212/ecadab17/attachment-0001.htm 



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