collectiveidea / interactor

Interactor provides a common interface for performing complex user interactions.
MIT License
3.36k stars 212 forks source link

Possible for callbacks in an organizer? #117

Closed binarymason closed 8 years ago

binarymason commented 8 years ago

Was suprised that I could not find a way to have an organizer perform callbacks.

Somewhat contrived example, but say I have a organizer that calls on a few interactors that work differently depending on the context:

class DriveMotorcycleToGroceryStore
  include Interactor::Organizer

  organize GetDirections, EngageVehicle, ParkInSpot

  before do
    context.car = "motorcycle"
    context.start_time = Time.now
    ...
  end
end

Possible to do this?

class DriveFancyCarToGroceryStore
  include Interactor::Organizer

  organize GetDirections, EngageVehicle, ParkInSpot

  before do
    context.car = "lamborghini"
    context.start_time = Time.now
    ....
  end
end
binarymason commented 8 years ago

Sorry, it appears it is possible

laserlemon commented 8 years ago

Glad you got it figured! I was getting worried! 😄