Class: Sh::Plugin
Class Attribute Summary collapse
-
.registered_plugins ⇒ Object
readonly
Returns the value of attribute registered_plugins.
Class Method Summary collapse
Methods included from PluginSugar
Class Attribute Details
.registered_plugins ⇒ Object (readonly)
Returns the value of attribute registered_plugins.
22 23 24 |
# File 'lib/sh_plugin.rb', line 22 def registered_plugins @registered_plugins end |
Class Method Details
.broadcast(method_name, *args) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/sh_plugin.rb', line 32 def self.broadcast(method_name, *args) registered_plugins.each_value do |plugin| if plugin.respond_to? method_name Thread.new {plugin.send method_name, *args} end end end |
.define(id_name, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/sh_plugin.rb', line 26 def self.define(id_name, &block) p = new p.instance_eval(&block) Plugin.registered_plugins[id_name] = p end |