Class: ROM::Plugin
- Inherits:
-
Object
- Object
- ROM::Plugin
- Extended by:
- Initializer
- Includes:
- Configurable
- Defined in:
- core/lib/rom/plugin.rb
Overview
Plugin is a simple object used to store plugin configurations
Direct Known Subclasses
Instance Attribute Summary collapse
-
#mod ⇒ Module
readonly
A module representing the plugin.
-
#name ⇒ Symbol
readonly
Plugin name.
-
#type ⇒ Symbol
readonly
Plugin type.
Instance Method Summary collapse
-
#apply_to(target, **options) ⇒ Object
private
Apply this plugin to the target.
-
#config ⇒ Config
included
from Configurable
private
Return config instance.
-
#configure {|config| ... } ⇒ self
included
from Configurable
Yield config instance.
Instance Attribute Details
#mod ⇒ Module (readonly)
Returns a module representing the plugin.
23 |
# File 'core/lib/rom/plugin.rb', line 23 param :mod |
#name ⇒ Symbol (readonly)
Returns plugin name.
18 |
# File 'core/lib/rom/plugin.rb', line 18 param :name |
#type ⇒ Symbol (readonly)
Returns plugin type.
28 |
# File 'core/lib/rom/plugin.rb', line 28 option :type |
Instance Method Details
#apply_to(target, **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.
Apply this plugin to the target
35 36 37 38 39 40 41 42 43 |
# File 'core/lib/rom/plugin.rb', line 35 def apply_to(target, **) if mod.respond_to?(:apply) mod.apply(target, **) elsif mod.respond_to?(:new) target.include(mod.new(**)) elsif target.is_a?(::Module) target.include(mod) end end |
#config ⇒ Config Originally defined in module Configurable
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.
Return config instance
#configure {|config| ... } ⇒ self Originally defined in module Configurable
Yield config instance