Sha256: 6f8e7e3fd53b99165871eb8607a03ad3c5c6bb0c8a9fd44099c1b75e10205d13

Contents?: true

Size: 810 Bytes

Versions: 3

Compression:

Stored size: 810 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

3 entries across 3 versions & 1 rubygems

Version Path
rom-core-4.0.0.beta3 lib/rom/plugin_base.rb
rom-core-4.0.0.beta2 lib/rom/plugin_base.rb
rom-core-4.0.0.beta1 lib/rom/plugin_base.rb