Class: Wee::Component::UnwindCall

Inherits:
Object
  • Object
show all
Defined in:
lib/wee/component.rb

Overview

Reverts the changes made due to Component#call. Is called when Component#call ‘answers’.

Instance Method Summary collapse

Constructor Details

#initialize(calling, called, delegate, answer, &return_callback) ⇒ UnwindCall

Returns a new instance of UnwindCall.



276
277
278
279
# File 'lib/wee/component.rb', line 276

def initialize(calling, called, delegate, answer, &return_callback)
  @calling, @called, @delegate, @answer = calling, called, delegate, answer
  @return_callback = return_callback
end

Instance Method Details

#call(answ) ⇒ Object



281
282
283
284
285
# File 'lib/wee/component.rb', line 281

def call(answ)
  @calling.remove_decoration(@delegate)
  @called.remove_decoration(@answer)
  @return_callback.call(*answ.args) if @return_callback
end