Module: Rig::Plugin::Base
- Defined in:
- lib/rig/plugin.rb
Class Method Summary collapse
Instance Method Summary collapse
- #command(name, desc, klass = nil, &block) ⇒ Object
- #config_for(klass) ⇒ Object
- #on(event, &block) ⇒ Object
Class Method Details
.included(base) ⇒ Object
37 38 39 |
# File 'lib/rig/plugin.rb', line 37 def self.included(base) base.extend self end |
Instance Method Details
#command(name, desc, klass = nil, &block) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rig/plugin.rb', line 45 def command(name, desc, klass=nil, &block) on "commands:loaded" do |args| command = args.shift if klass command.subcommand name, "#{desc} (#{self})", klass else command.subcommand name, "#{desc} (#{self})", &block end end end |
#config_for(klass) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/rig/plugin.rb', line 56 def config_for(klass) name = klass.name.split('::').last.downcase.to_sym return Rig.config[:plugins][name] if Rig.config[:plugins] && Rig.config[:plugins][name] return Rig.account[:plugins][name] if Rig.account[:plugins] && Rig.account[:plugins][name] { } end |