Class: ROM::Configuration
- Inherits:
-
Object
- Object
- ROM::Configuration
- Extended by:
- Forwardable, Notifications
- Includes:
- ConfigurationDSL
- Defined in:
- core/lib/rom/configuration.rb
Constant Summary collapse
- NoDefaultAdapterError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#notifications ⇒ Object
readonly
Returns the value of attribute notifications.
-
#setup ⇒ Object
readonly
Returns the value of attribute setup.
Class Method Summary collapse
-
.register_event(id, info = EMPTY_HASH) ⇒ Object
extended
from Notifications
Register an event.
Instance Method Summary collapse
-
#commands(name, &block) ⇒ Object
included
from ConfigurationDSL
Command definition DSL.
-
#mappers(&block) ⇒ Object
included
from ConfigurationDSL
Mapper definition DSL.
-
#plugin(adapter, spec, &block) ⇒ Plugin
included
from ConfigurationDSL
Configures a plugin for a specific adapter to be enabled for all relations.
-
#relation(name, options = EMPTY_HASH, &block) ⇒ Object
included
from ConfigurationDSL
Relation definition DSL.
-
#use(plugin, options = {}) ⇒ Configuration
Apply a plugin to the configuration.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Gateway (private)
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.
Returns gateway if method is a name of a registered gateway
130 131 132 |
# File 'core/lib/rom/configuration.rb', line 130 def method_missing(name, *) gateways.fetch(name) { super } end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
29 30 31 |
# File 'core/lib/rom/configuration.rb', line 29 def environment @environment end |
#notifications ⇒ Object (readonly)
Returns the value of attribute notifications.
37 38 39 |
# File 'core/lib/rom/configuration.rb', line 37 def notifications @notifications end |
#setup ⇒ Object (readonly)
Returns the value of attribute setup.
33 34 35 |
# File 'core/lib/rom/configuration.rb', line 33 def setup @setup end |
Class Method Details
.register_event(id, info = EMPTY_HASH) ⇒ Object Originally defined in module Notifications
Register an event
Instance Method Details
#commands(name, &block) ⇒ Object Originally defined in module ConfigurationDSL
Command definition DSL
#mappers(&block) ⇒ Object Originally defined in module ConfigurationDSL
Mapper definition DSL
#plugin(adapter, spec, &block) ⇒ Plugin Originally defined in module ConfigurationDSL
Configures a plugin for a specific adapter to be enabled for all relations
#relation(name, options = EMPTY_HASH, &block) ⇒ Object Originally defined in module ConfigurationDSL
Relation definition DSL
#use(plugin, options = {}) ⇒ Configuration
Apply a plugin to the configuration
68 69 70 71 72 73 74 75 76 77 78 |
# File 'core/lib/rom/configuration.rb', line 68 def use(plugin, = {}) if plugin.is_a?(Array) plugin.each { |p| use(p) } elsif plugin.is_a?(Hash) plugin.to_a.each { |p| use(*p) } else ROM.plugin_registry[:configuration].fetch(plugin).apply_to(self, ) end self end |