Sha256: f8560ec57c68174284a0e41d088b7cdf650eaf4a990d7fc01b515c14d9c91468

Contents?: true

Size: 700 Bytes

Versions: 3

Compression:

Stored size: 700 Bytes

Contents

# frozen_string_literal: true

require 'rom/plugin_base'

module ROM
  # @api private
  class SchemaPlugin < PluginBase
    include Configurable

    # Apply this plugin to the provided configuration
    #
    # @param [ROM::Schema] schema A schema instance for extension
    # @param [Hash] options Extension options
    #
    # @api private
    def apply_to(schema, options = EMPTY_HASH)
      mod.apply(schema, options) if mod.respond_to?(:apply)
    end

    # Extends a DSL instance with a module provided by the plugin
    #
    # @param [ROM::Schema::DSL] dsl
    #
    # @api private
    def extend_dsl(dsl)
      dsl.extend(mod.const_get(:DSL)) if mod.const_defined?(:DSL)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-core-5.0.2 lib/rom/schema_plugin.rb
rom-core-5.0.1 lib/rom/schema_plugin.rb
rom-core-5.0.0 lib/rom/schema_plugin.rb