Class: Command
Instance Attribute Summary collapse
-
#arg ⇒ Object
readonly
Returns the value of attribute arg.
Attributes inherited from Plugin
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cmd, opts = {}, &blk) ⇒ Command
constructor
A new instance of Command.
Methods inherited from Plugin
Constructor Details
#initialize(cmd, opts = {}, &blk) ⇒ Command
Returns a new instance of Command.
32 33 34 35 36 |
# File 'lib/raphael/plugin.rb', line 32 def initialize cmd, opts={}, &blk @proc = blk @opts = opts @arg = cmd end |
Instance Attribute Details
#arg ⇒ Object (readonly)
Returns the value of attribute arg.
31 32 33 |
# File 'lib/raphael/plugin.rb', line 31 def arg @arg end |
Class Method Details
.check(text) ⇒ Object
44 45 46 47 48 |
# File 'lib/raphael/plugin.rb', line 44 def check text @plugins.any? do |plugin| text =~ /^@(?:nkroid)\s+#{plugin.arg}/ end end |
.register(cmd, opts = {}, &blk) ⇒ Object
39 40 41 42 |
# File 'lib/raphael/plugin.rb', line 39 def register cmd, opts={}, &blk @plugins ||= [] @plugins << self.new(cmd, opts, &blk) end |