Sha256: 35f5b8c2f4619a703789325d60018fb51d4b9cef03445a40c1e5fead3a15e399

Contents?: true

Size: 811 Bytes

Versions: 10

Compression:

Stored size: 811 Bytes

Contents

module ROM
  # Abstract plugin base
  #
  # @private
  class PluginBase
    # @return [Module] a module representing the plugin
    #
    # @api private
    attr_reader :mod

    # @return [Hash] configuration options
    #
    # @api private
    attr_reader :options

    # @api private
    attr_reader :type

    # @api private
    def initialize(mod, options)
      @mod      = mod
      @options  = options
      @type = options.fetch(:type)
    end

    # @api private
    def relation?
      type == :relation
    end

    # @api private
    def schema?
      type == :schema
    end

    # Apply this plugin to the provided class
    #
    # @param [Mixed] _base
    #
    # @api private
    def apply_to(_base)
      raise NotImplementedError, "#{self.class}#apply_to not implemented"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rom-core-4.2.1 lib/rom/plugin_base.rb
rom-core-4.2.0 lib/rom/plugin_base.rb
rom-core-4.1.2 lib/rom/plugin_base.rb
rom-core-4.1.1 lib/rom/plugin_base.rb
rom-core-4.1.0 lib/rom/plugin_base.rb
rom-core-4.0.2 lib/rom/plugin_base.rb
rom-core-4.0.1 lib/rom/plugin_base.rb
rom-core-4.0.0 lib/rom/plugin_base.rb
rom-core-4.0.0.rc2 lib/rom/plugin_base.rb
rom-core-4.0.0.rc1 lib/rom/plugin_base.rb