[Groonga-commit] ranguba/rroonga at f37a22a [master] Remove view

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Mar 6 18:49:10 JST 2014


Kouhei Sutou	2014-03-06 18:49:10 +0900 (Thu, 06 Mar 2014)

  New Revision: f37a22ad2d12df20d67399ba6440dfdce293d220
  https://github.com/ranguba/rroonga/commit/f37a22ad2d12df20d67399ba6440dfdce293d220

  Message:
    Remove view
    
    It has been removed from Groonga.

  Modified files:
    lib/groonga/schema.rb

  Modified: lib/groonga/schema.rb (+0 -232)
===================================================================
--- lib/groonga/schema.rb    2014-03-06 18:47:32 +0900 (6624bfd)
+++ lib/groonga/schema.rb    2014-03-06 18:49:10 +0900 (46fe075)
@@ -470,82 +470,6 @@ module Groonga
         end
       end
 
-      # 名前が_name_のビューを作成する。以下の省略形。
-      #
-      # <pre>
-      # !!!ruby
-      # Groonga::Schema.define do |schema|
-      #   schema.create_view(name, options) do |view|
-      #     # ...
-      #   end
-      # end
-      # </pre>
-      # ブロックには {Groonga::Schema::ViewDefinition} オブジェ
-      # クトがわたるので、そのオブジェクトを利用してビュー
-      # の詳細を定義する。
-      #
-      # @param options [::Hash] The name and value
-      #   pairs. Omitted names are initialized as the default value.
-      # @option options :force The force
-      #
-      #   +true+ を指定すると既存の同名のビューが
-      #   存在していても、強制的にビューを作成する。
-      # @option options :context (Groonga::Context.default) The context
-      #
-      #   スキーマ定義時に使用する {Groonga::Context} を指定する。
-      # @option options :path The path
-      #
-      #   ビューを保存するパスを指定する。
-      #   パスを指定すると永続ビューになる。
-      # @option options :persistent (true) The persistent
-      #
-      #   ビューを永続ビューとする。 +:path:+ を省略した場
-      #   合はパス名は自動的に作成される。デフォルトでは永続
-      #   ビューとなる。
-      def create_view(name, options={}, &block)
-        define do |schema|
-          schema.create_view(name, options, &block)
-        end
-      end
-
-      # 名前が _name_ のテーブルを削除する。
-      #
-      # @param options [::Hash] The name and value
-      #   pairs. Omitted names are initialized as the default value.
-      # @option options :context (Groonga::context.default) The context
-      #   スキーマ定義時に使用する {Groonga::Context} を指定する。
-      def remove_view(name, options={})
-        define do |schema|
-          schema.remove_view(name, options)
-        end
-      end
-
-      # 名前が _name_ のビューを変更する。以下の省略形。
-      #
-      # <pre>
-      # !!!ruby
-      # Groonga::Schema.define do |schema|
-      #   schema.change_view(name, options) do |view|
-      #     # ...
-      #   end
-      # end
-      # </pre>
-      #
-      # ブロックには {Groonga::Schema::ViewDefinition} オブジェ
-      # クトがわたるので、そのオブジェクトを利用してテーブル
-      # の詳細を定義する。
-      #
-      # @param options [::Hash] The name and value
-      #   pairs. Omitted names are initialized as the default value.
-      # @option options :context (Groonga::Context.default) The context
-      #
-      #   スキーマ定義時に使用する {Groonga::Context} を指定する。
-      def change_view(name, options={}, &block)
-        define do |schema|
-          schema.change_view(name, options, &block)
-        end
-      end
-
       # 以下と同様:
       #
       # <pre>
@@ -825,69 +749,6 @@ module Groonga
       @definitions << definition
     end
 
-    # 名前が _name_ のビューを作成する。
-    #
-    # ビューの作成は {#define} を呼び出すまでは実行されないこ
-    # とに注意すること。
-    #
-    # @param options [::Hash] The name and value
-    #   pairs. Omitted names are initialized as the default value.
-    # @option options :force The force
-    #
-    #   +true+ を指定すると既存の同名の
-    #   ビューが存在していても、強制的にビューを作成する。
-    # @option options [Groonga::Context] :context (Groonga::Schema.new) The context
-    #
-    #   スキーマ定義時に使用する {Groonga::Context} を指定する。
-    #   {Groonga::Schema.new} で指定していない場合は
-    #   {Groonga::Context.default} を使用する。
-    # @option options :path The path
-    #
-    #   テーブルを保存するパスを指定する。パスを指定すると
-    #   永続テーブルになる。
-    # @option options :persistent (true) The persistent
-    #
-    #   テーブルを永続テーブルとする。 +:path:+ を省略した場合は
-    #   パス名は自動的に作成される。デフォルトでは永続テーブルとなる。
-    def create_view(name, options={})
-      definition = ViewDefinition.new(name, @options.merge(options || {}))
-      yield(definition)
-      @definitions << definition
-    end
-
-    # 名前が _name_ のビューを削除する。
-    #
-    # ビューの削除は {#define} を呼び出すまでは実行されないことに
-    # 注意すること。
-    #
-    # @param options [::Hash] The name and value
-    #   pairs. Omitted names are initialized as the default value.
-    # @option options [Groonga::Context] :context (Groonga::Context.default)
-    #   The context
-    #
-    #   スキーマ定義時に使用する {Groonga::Context} を指定する。
-    def remove_view(name, options={})
-      definition = ViewRemoveDefinition.new(name, @options.merge(options || {}))
-      @definitions << definition
-    end
-
-    # 名前が _name_ のビューを変更する。
-    #
-    # ビューの変更は {#define} を呼び出すまでは実行されないこ
-    # とに注意すること。
-    #
-    # @param options [::Hash] The name and value
-    #   pairs. Omitted names are initialized as the default value.
-    # @option options :context (Groonga::Context.default) The context
-    #
-    #   スキーマ定義時に使用する {Groonga::Context} を指定する。
-    def change_view(name, options={})
-      options =****@optio*****(options || {}).merge(:change => true)
-      definition = ViewDefinition.new(name, options)
-      yield(definition)
-      @definitions << definition
-    end
-
     # 以下と同様:
     #
     # <pre>
@@ -1596,99 +1457,6 @@ module Groonga
       end
     end
 
-    # スキーマ定義時に {Groonga::Schema.create_view} や
-    # {Groonga::Schema#create_view} からブロックに渡されてくる
-    # オブジェクト
-    class ViewDefinition
-      # ビューの名前
-      attr_reader :name
-
-      # @private
-      def initialize(name, options)
-        @name = name
-        @name =****@name*****_s if****@name*****_a?(Symbol)
-        @tables = []
-        validate_options(options)
-        @options = options
-      end
-
-      # @private
-      def define
-        view = context[@name]
-        if @options[:change]
-          raise TableNotExists.new(@name) if view.nil?
-        else
-          if view and @options[:force]
-            view.remove
-            view = nil
-          end
-          view ||= Groonga::View.create(create_options)
-        end
-        @tables.each do |table|
-          unless table.is_a?(Groonga::Table)
-            table_name = table
-            table = context[table_name]
-            raise TableNotExists.new(table_name) if table.nil?
-          end
-          view.add_table(table)
-        end
-        view
-      end
-
-      # 名前が _table_ のテーブルをビューに追加する。
-      def add(table)
-        table = table.to_s if table.is_a?(Symbol)
-        @tables << table
-        self
-      end
-
-      # @private
-      def context
-        @options[:context] || Groonga::Context.default
-      end
-
-      private
-      # @private
-      AVAILABLE_OPTION_KEYS = [:context, :change, :force,
-                               :path, :persistent, :named_path]
-      # @private
-      def validate_options(options)
-        return if options.nil?
-        unknown_keys = options.keys - AVAILABLE_OPTION_KEYS
-        unless unknown_keys.empty?
-          raise UnknownOptions.new(options, unknown_keys, AVAILABLE_OPTION_KEYS)
-        end
-      end
-
-      # @private
-      def create_options
-        {
-          :name => @name,
-          :path => @options[:path],
-          :persistent => persistent?,
-          :context => context,
-        }
-      end
-
-      # @private
-      def persistent?
-        @options[:persistent].nil? ? true : @options[:persistent]
-      end
-    end
-
-    # @private
-    class ViewRemoveDefinition
-      def initialize(name, options={})
-        @name = name
-        @options = options
-      end
-
-      def define
-        context = @options[:context] || Groonga::Context.default
-        context[@name].remove
-      end
-    end
-
     # @private
     class ColumnDefinition
       include Path
-------------- next part --------------
HTML����������������������������...
Download 



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