Class: Motel::Callbacks::Base
- Inherits:
-
Object
- Object
- Motel::Callbacks::Base
- Defined in:
- lib/motel/callbacks.rb
Overview
Base Motel callback interface, provides access to invocable handler
Instance Attribute Summary collapse
-
#handler ⇒ Object
Accessor which will be invoked upon callback event.
Instance Method Summary collapse
-
#initialize(args = {}, &block) ⇒ Base
constructor
A new instance of Base.
-
#invoke(args = []) ⇒ Object
FIXME XXX this should be *args instead of args = [] (remove [] around super calls below).
Constructor Details
#initialize(args = {}, &block) ⇒ Base
Returns a new instance of Base.
22 23 24 25 |
# File 'lib/motel/callbacks.rb', line 22 def initialize(args = {}, &block) @handler = args[:handler] if args.has_key?(:handler) @handler = block if block_given? end |
Instance Attribute Details
#handler ⇒ Object
Accessor which will be invoked upon callback event
20 21 22 |
# File 'lib/motel/callbacks.rb', line 20 def handler @handler end |
Instance Method Details
#invoke(args = []) ⇒ Object
FIXME XXX this should be *args instead of args = [] (remove [] around super calls below)
28 29 30 |
# File 'lib/motel/callbacks.rb', line 28 def invoke(args = []) handler.call *args end |