Module: ROM::Plugins

Extended by:
Dry::Core::Container::Mixin, Enumerable
Defined in:
lib/rom/plugins.rb,
lib/rom/plugins/dsl.rb,
lib/rom/plugins/class_methods.rb,
lib/rom/plugins/command/schema.rb,
lib/rom/plugins/schema/timestamps.rb,
lib/rom/plugins/command/timestamps.rb,
lib/rom/plugins/relation/changeset.rb,
lib/rom/plugins/relation/instrumentation.rb,
lib/rom/plugins/relation/registry_reader.rb

Overview

Registry of all known plugins

Defined Under Namespace

Modules: ClassMethods, Command, Relation, Schema Classes: DSL, Resolver

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



90
91
92
93
94
95
96
# File 'lib/rom/plugins.rb', line 90

def [](key)
  if key?(key)
    super
  else
    Resolver.new(self, type: key)
  end
end

.dsl(*args, &block) ⇒ Object



24
25
26
# File 'lib/rom/plugins.rb', line 24

def dsl(*args, &block)
  Plugins::DSL.new(self, *args, &block)
end

.eachObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/rom/plugins.rb', line 36

def each
  keys.each { |key| yield(self[key]) }
end

.register(name, type:, **options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
# File 'lib/rom/plugins.rb', line 29

def register(name, type:, **options)
  Plugin.new(name: name, type: type, **options).tap do |plugin|
    super(plugin.key, plugin)
  end
end

.resolve(key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
44
45
# File 'lib/rom/plugins.rb', line 41

def resolve(key)
  super
rescue ::Dry::Core::Container::KeyError
  raise ROM::UnknownPluginError, "+#{key}+ plugin was not found"
end