Class: Hookem::HookCallable
- Inherits:
-
Struct
- Object
- Struct
- Hookem::HookCallable
- Defined in:
- lib/hookem.rb
Instance Attribute Summary collapse
-
#callable ⇒ Object
Returns the value of attribute callable.
-
#eventloop ⇒ Object
Returns the value of attribute eventloop.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#preargs ⇒ Object
Returns the value of attribute preargs.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(hash) ⇒ HookCallable
constructor
A new instance of HookCallable.
Constructor Details
#initialize(hash) ⇒ HookCallable
Returns a new instance of HookCallable.
5 6 7 8 9 |
# File 'lib/hookem.rb', line 5 def initialize(hash) super(*hash.values_at(*self.class.members.map(&:to_sym)) ) self.preargs ||= [] self.identifier ||= self.__id__ end |
Instance Attribute Details
#callable ⇒ Object
Returns the value of attribute callable
4 5 6 |
# File 'lib/hookem.rb', line 4 def callable @callable end |
#eventloop ⇒ Object
Returns the value of attribute eventloop
4 5 6 |
# File 'lib/hookem.rb', line 4 def eventloop @eventloop end |
#identifier ⇒ Object
Returns the value of attribute identifier
4 5 6 |
# File 'lib/hookem.rb', line 4 def identifier @identifier end |
#preargs ⇒ Object
Returns the value of attribute preargs
4 5 6 |
# File 'lib/hookem.rb', line 4 def preargs @preargs end |
Instance Method Details
#call(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/hookem.rb', line 11 def call(*args) if eventloop eventloop.enqueue do _execute(*args) end else _execute(*args) end end |