Class: DiandianOAuth::Client::Callbacks::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/diandian_oauth/client/callbacks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#executorObject

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