[Groonga-commit] droonga/droonga-engine at 275abcc [master] Pass validated values to avoid typos in parameter name

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Apr 23 14:33:49 JST 2014


Kouhei Sutou	2014-04-23 14:33:49 +0900 (Wed, 23 Apr 2014)

  New Revision: 275abccec9454813d506f7d57933fe0b97f7f70f
  https://github.com/droonga/droonga-engine/commit/275abccec9454813d506f7d57933fe0b97f7f70f

  Message:
    Pass validated values to avoid typos in parameter name

  Modified files:
    lib/droonga/plugins/groonga/column_create.rb
    lib/droonga/plugins/groonga/column_remove.rb
    lib/droonga/plugins/groonga/column_rename.rb

  Modified: lib/droonga/plugins/groonga/column_create.rb (+4 -6)
===================================================================
--- lib/droonga/plugins/groonga/column_create.rb    2014-04-23 14:22:38 +0900 (b424b87)
+++ lib/droonga/plugins/groonga/column_create.rb    2014-04-23 14:33:49 +0900 (c19120a)
@@ -36,15 +36,14 @@ module Droonga
             end
 
             if****@comma*****_index?
-              define_index
+              define_index(table_name)
             else
-              define_column
+              define_column(table_name)
             end
           end
 
           private
-          def define_column
-            table_name = @command["table"]
+          def define_column(table_name)
             column_name = @command["name"]
             column_type = @command["type"]
 
@@ -76,8 +75,7 @@ module Droonga
             options
           end
 
-          def define_index
-            table_name = @command["table"]
+          def define_index(table_name)
             target_table = @command["type"]
             target_columns = (@command["source"] || "").split(/\s*,\s*/)
 

  Modified: lib/droonga/plugins/groonga/column_remove.rb (+2 -5)
===================================================================
--- lib/droonga/plugins/groonga/column_remove.rb    2014-04-23 14:22:38 +0900 (7b24758)
+++ lib/droonga/plugins/groonga/column_remove.rb    2014-04-23 14:33:49 +0900 (0990c46)
@@ -43,14 +43,11 @@ module Droonga
                                      :result => false)
             end
 
-            remove_column
+            remove_column(table_name, column_name)
           end
 
           private
-          def remove_column
-            table_name = @command["table"]
-            column_name = @command["name"]
-
+          def remove_column(table_name, column_name)
             ::Groonga::Schema.define(:context => @context) do |schema|
               schema.change_table(table_name) do |table|
                 table.remove_column(column_name)

  Modified: lib/droonga/plugins/groonga/column_rename.rb (+4 -6)
===================================================================
--- lib/droonga/plugins/groonga/column_rename.rb    2014-04-23 14:22:38 +0900 (659b4e2)
+++ lib/droonga/plugins/groonga/column_rename.rb    2014-04-23 14:33:49 +0900 (f8c871c)
@@ -43,15 +43,13 @@ module Droonga
                                      :result => false)
             end
 
-            rename_column
+            new_name = @command["new_name"]
+
+            rename_column(table_name, column_name, new_name)
           end
 
           private
-          def rename_column
-            table_name = @command["table"]
-            column_name = @command["name"]
-            new_name = @command["new_name"]
-
+          def rename_column(table_name, column_name, new_name)
             ::Groonga::Schema.define(:context => @context) do |schema|
               schema.change_table(table_name) do |table|
                 table.rename_column(column_name, new_name)
-------------- next part --------------
HTML����������������������������...
Download 



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