Class: Ellen::Handlers::Base
- Inherits:
-
Object
- Object
- Ellen::Handlers::Base
- Extended by:
- Mem
- Defined in:
- lib/ellen/handlers/base.rb
Instance Attribute Summary collapse
-
#robot ⇒ Object
readonly
Returns the value of attribute robot.
Class Method Summary collapse
Instance Method Summary collapse
- #call(message) ⇒ Object
-
#initialize(robot) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(robot) ⇒ Base
Returns a new instance of Base.
34 35 36 |
# File 'lib/ellen/handlers/base.rb', line 34 def initialize(robot) @robot = robot end |
Instance Attribute Details
#robot ⇒ Object (readonly)
Returns the value of attribute robot.
32 33 34 |
# File 'lib/ellen/handlers/base.rb', line 32 def robot @robot end |
Class Method Details
.actions ⇒ Object
26 27 28 |
# File 'lib/ellen/handlers/base.rb', line 26 def actions [] end |
.inherited(child) ⇒ Object
18 19 20 |
# File 'lib/ellen/handlers/base.rb', line 18 def inherited(child) Ellen.handlers << child end |
.on(pattern, options = {}) ⇒ Object
22 23 24 |
# File 'lib/ellen/handlers/base.rb', line 22 def on(pattern, = {}) actions << Action.new(pattern, ) end |
Instance Method Details
#call(message) ⇒ Object
38 39 40 41 42 |
# File 'lib/ellen/handlers/base.rb', line 38 def call() self.class.actions.each do |action| action.call(self, ) end end |