Class: Mobility::Pluggable
- Inherits:
-
Module
- Object
- Module
- Mobility::Pluggable
- Defined in:
- lib/mobility/pluggable.rb
Overview
Abstract Module subclass with methods to define plugins and defaults. Works with Plugin. (Subclassed by Translations.)
Direct Known Subclasses
Defined Under Namespace
Classes: InvalidOptionKey
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .defaults ⇒ Object
- .included_plugins ⇒ Object
- .inherited(klass) ⇒ Object
- .plugin(name, *args) ⇒ Object
- .plugins(&block) ⇒ Object
Instance Method Summary collapse
-
#initialize(**options) ⇒ Pluggable
constructor
A new instance of Pluggable.
Constructor Details
#initialize(**options) ⇒ Pluggable
Returns a new instance of Pluggable.
34 35 36 37 |
# File 'lib/mobility/pluggable.rb', line 34 def initialize(*, **) () (@options) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
39 40 41 |
# File 'lib/mobility/pluggable.rb', line 39 def @options end |
Class Method Details
.defaults ⇒ Object
24 25 26 |
# File 'lib/mobility/pluggable.rb', line 24 def defaults @defaults ||= {} end |
.included_plugins ⇒ Object
20 21 22 |
# File 'lib/mobility/pluggable.rb', line 20 def included_plugins included_modules.grep(Plugin) end |
.inherited(klass) ⇒ Object
28 29 30 31 |
# File 'lib/mobility/pluggable.rb', line 28 def inherited(klass) super klass.defaults.merge!(defaults) end |