Module: Nuggets::Pluggable
- Defined in:
- lib/nuggets/pluggable.rb
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#plugin_filename ⇒ Object
48 49 50 51 52 53 |
# File 'lib/nuggets/pluggable.rb', line 48 def plugin_filename @plugin_filename ||= "#{name. gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2'). gsub(/([a-z\d])([A-Z])/, '\1_\2'). gsub(/::/, '/').tr('-', '_').downcase}_plugin.rb" end |
Class Method Details
.load_plugins_for(*klasses) ⇒ Object
32 33 34 |
# File 'lib/nuggets/pluggable.rb', line 32 def self.load_plugins_for(*klasses) klasses.map { |klass| klass.extend(self).load_plugins } end |
Instance Method Details
#load_plugins(name = plugin_filename) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/nuggets/pluggable.rb', line 36 def load_plugins(name = plugin_filename) load_path_plugins(name) load_gem_plugins(name) load_env_plugins(name) loaded_plugins.to_a end |
#loaded_plugins ⇒ Object
44 45 46 |
# File 'lib/nuggets/pluggable.rb', line 44 def loaded_plugins @loaded_plugins ||= Set.new end |