Class: Pluggable::PluginFactory
- Inherits:
-
Array
- Object
- Array
- Pluggable::PluginFactory
- Includes:
- Singleton
- Defined in:
- lib/pluggable.rb
Instance Method Summary collapse
- #build_plugins(*args) ⇒ Object
- #delegate_plugin_public_methods_to_plugins_class_except(*excluded_methods) ⇒ Object
Instance Method Details
#build_plugins(*args) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/pluggable.rb', line 22 def build_plugins(*args) array_of_instance_and_name_pairs = map do |each| instance = each.new(*args) {:name => variable_name_for_plugin_instance(instance), :instance => instance} end Plugins.from_array_of_instance_and_name_pairs(array_of_instance_and_name_pairs) end |
#delegate_plugin_public_methods_to_plugins_class_except(*excluded_methods) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/pluggable.rb', line 29 def delegate_plugin_public_methods_to_plugins_class_except *excluded_methods excluded_methods = excluded_methods.map{|each| each.to_s} each do |klass| delegated_methods = klass.public_instance_methods-Plugin.public_instance_methods-excluded_methods variable_name = variable_name_for_plugin_class klass Plugins.def_delegators variable_name, *delegated_methods end end |