Class: DiandianOAuth::Client::Callbacks::Callback
- Inherits:
-
Object
- Object
- DiandianOAuth::Client::Callbacks::Callback
- Defined in:
- lib/diandian_oauth/client/callbacks.rb
Instance Attribute Summary collapse
-
#executor ⇒ Object
Returns the value of attribute executor.
Instance Method Summary collapse
- #apply(client, *args, &block) ⇒ Object
-
#initialize(proc_or_method) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(proc_or_method) ⇒ Callback
Returns a new instance of Callback.
6 7 8 |
# File 'lib/diandian_oauth/client/callbacks.rb', line 6 def initialize proc_or_method self.executor = proc_or_method end |
Instance Attribute Details
#executor ⇒ Object
Returns the value of attribute executor.
5 6 7 |
# File 'lib/diandian_oauth/client/callbacks.rb', line 5 def executor @executor end |
Instance Method Details
#apply(client, *args, &block) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/diandian_oauth/client/callbacks.rb', line 9 def apply client, *args, &block case executor when Symbol then client.send(executor, *args, &block) when Proc then executor.call( client, *args, &block) end end |