Class: Chatterbot::Handler
- Inherits:
-
Object
- Object
- Chatterbot::Handler
- Defined in:
- lib/chatterbot/handler.rb
Overview
class for holding onto a block/arguments we will use when calling methods on the Twitter API
Instance Attribute Summary collapse
-
#last_ran_at ⇒ Object
readonly
Returns the value of attribute last_ran_at.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
call the block with the specified arguments.
-
#initialize(opts, &block) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(opts, &block) ⇒ Handler
Returns a new instance of Handler.
11 12 13 14 15 16 17 18 19 |
# File 'lib/chatterbot/handler.rb', line 11 def initialize(opts, &block) if block_given? @opts = *opts @block = block else @opts = nil @block = opts end end |
Instance Attribute Details
#last_ran_at ⇒ Object (readonly)
Returns the value of attribute last_ran_at.
9 10 11 |
# File 'lib/chatterbot/handler.rb', line 9 def last_ran_at @last_ran_at end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
8 9 10 |
# File 'lib/chatterbot/handler.rb', line 8 def opts @opts end |
Instance Method Details
#call(*args) ⇒ Object
call the block with the specified arguments
24 25 26 27 |
# File 'lib/chatterbot/handler.rb', line 24 def call(*args) @last_ran_at = Time.now @block.call(*args) end |