Sha256: fda2929fca253166d262ffda3a27d7e679b5527af10b328f3c66abed33a1c170

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

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-5.0.2 lib/rom/plugin_base.rb
rom-core-5.0.1 lib/rom/plugin_base.rb
rom-core-5.0.0 lib/rom/plugin_base.rb