Class: Vedeu::Plugin Private
- Inherits:
-
Object
- Object
- Vedeu::Plugin
- Defined in:
- lib/vedeu/plugins/plugin.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A class responsible for plugin loading.
Instance Attribute Summary collapse
- #enabled ⇒ Boolean (also: #enabled?)
- #gem ⇒ String readonly private
- #gem_name ⇒ String readonly private
-
#name ⇒ NilClass|Symbol|String
readonly
private
The name of the model, the target model or the name of the associated model.
Instance Method Summary collapse
-
#initialize(name, gem) ⇒ Vedeu::Plugin
constructor
private
Returns a new instance of Vedeu::Plugin.
-
#load! ⇒ void
private
Load the plugin (require the gem).
Constructor Details
#initialize(name, gem) ⇒ Vedeu::Plugin
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 a new instance of Vedeu::Plugin.
33 34 35 36 37 38 |
# File 'lib/vedeu/plugins/plugin.rb', line 33 def initialize(name, gem) @name = name @gem = gem @gem_name = "vedeu_#{name}" @enabled = false end |
Instance Attribute Details
#enabled ⇒ Boolean Also known as: enabled?
25 26 27 |
# File 'lib/vedeu/plugins/plugin.rb', line 25 def enabled @enabled end |
#gem ⇒ String (readonly)
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.
17 18 19 |
# File 'lib/vedeu/plugins/plugin.rb', line 17 def gem @gem end |
#gem_name ⇒ String (readonly)
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.
21 22 23 |
# File 'lib/vedeu/plugins/plugin.rb', line 21 def gem_name @gem_name end |
#name ⇒ NilClass|Symbol|String (readonly)
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 The name of the model, the target model or the name of the associated model.
13 14 15 |
# File 'lib/vedeu/plugins/plugin.rb', line 13 def name @name end |
Instance Method Details
#load! ⇒ void
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.
This method returns an undefined value.
Load the plugin (require the gem).
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vedeu/plugins/plugin.rb', line 44 def load! begin require gem_name unless enabled? rescue LoadError => error raise Vedeu::Error::Fatal, "Unable to load plugin #{gem_name} due to #{error}." rescue => error raise Vedeu::Error::Fatal, "require '#{gem_name}' failed with #{error}." end @enabled = true end |