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
49 50 51 52 53 54 |
# File 'lib/nuggets/pluggable.rb', line 49 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
33 34 35 |
# File 'lib/nuggets/pluggable.rb', line 33 def self.load_plugins_for(*klasses) klasses.map { |klass| klass.extend(self).load_plugins } end |
Instance Method Details
#load_plugins(name = plugin_filename) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/nuggets/pluggable.rb', line 37 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
45 46 47 |
# File 'lib/nuggets/pluggable.rb', line 45 def loaded_plugins @loaded_plugins ||= Set.new end |