Sha256: d75efbf5a44ac20ebfc7748e7b47c783b79395c1da8e7246c2469e7de1feb763

Contents?: true

Size: 1.57 KB

Versions: 21

Compression:

Stored size: 1.57 KB

Contents

module Partitioned
  class MultiLevel
    #
    # Configuration manager for multi-level partitioning
    # it supports, the front-end UI (a Domain Specific Language) using {Dsl}
    # state using {Data}
    # and a parser using {Reader}
    #
    module Configurator
      # The Domain Specific Language UI manager for multi level partitioning classes 
      class Dsl < Partitioned::PartitionedBase::Configurator::Dsl
        # used to prevent use of invalid directives
        class InvalidForMultiLevelPartitioning < StandardError
          def initialize(model, dsl_key, remedy)
            super("#{model.name}: '#{dsl_key}' is not valid for multi-level partitioning.  #{remedy}")
          end
        end

        attr_reader :data, :model

        def initialize(most_derived_activerecord_class)
          super(most_derived_activerecord_class, Partitioned::MultiLevel::Configurator::Data)
          @using_classes = []
        end

        #
        # Definition of classes which will be used at multi level partitioning.
        #
        # @param [*Array<Class>] classes the classes, in order, used to partition this model
        # @return [optional]
        def using_classes(*classes)
          data.using_classes += [*classes]
        end

        # @raise [InvalidForMultiLevelPartitioning] always raised. `on` is not a valid DSL directive for multi-level partitioning
        def on(*ignored)
          raise InvalidForMultiLevelPartitioning.new(model, :on, "the partitioned keyword 'using' is used to define multi-level partitioned tables.")
        end
        
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
partitioned-2.1.0 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-2.0.0 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.3.5 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.3.4 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.3.3 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.3.2 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.3.1 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.3.0 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.2.1 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.2.0 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.11 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.10 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.9 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.8 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.7 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.6 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.5 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.3 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.1 lib/partitioned/multi_level/configurator/dsl.rb
partitioned-1.1.0 lib/partitioned/multi_level/configurator/dsl.rb