Class: Cognition::Plugins::Base
- Inherits:
-
Object
- Object
- Cognition::Plugins::Base
- Defined in:
- lib/cognition/plugins/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#matchers ⇒ Object
Returns the value of attribute matchers.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 |
# File 'lib/cognition/plugins/base.rb', line 6 def initialize @matchers = self.class.definitions.collect do |trigger, help, method_name| Matcher.new(trigger, help, &Proc.new(&method(method_name))) end end |
Instance Attribute Details
#matchers ⇒ Object
Returns the value of attribute matchers.
4 5 6 |
# File 'lib/cognition/plugins/base.rb', line 4 def matchers @matchers end |
Class Method Details
.definitions ⇒ Object
16 17 18 |
# File 'lib/cognition/plugins/base.rb', line 16 def self.definitions @definitions ||= [] end |
.match(trigger, help, action) ⇒ Object
12 13 14 |
# File 'lib/cognition/plugins/base.rb', line 12 def self.match(trigger, help, action) definitions << [trigger, help, action] end |