-
Notifications
You must be signed in to change notification settings - Fork 31
Interactor
Sunny Ripert edited this page Jan 17, 2026
·
7 revisions
This gem is heavily influenced by Interactor ♥.
Some key differences make Actor unique:
- Defaults to raising errors on failures: actor uses
callandresultinstead ofcall!andcall. This way, the default is to raise an error and failures are not hidden away because you forgot to use!. - Requires documenting arguments with
inputandoutput. - Shorter setup syntax: inherit from
< Actorvs having toinclude Interactor+include Interactor::Organizer. - Shorter syntax when calling the context:
foovscontext.foo,self.foo =vscontext.foo =,fail!vscontext.fail!. - No
before&afterhooks, prefer usingplay. -
Does not hide errors when an actor fails inside another actor(finally fixed in Interactor).
As well as these extra features:
- Can add defaults to inputs.
- Can add type checking to inputs.
- Can add requirements and conditions on inputs.
- Can use lambdas and instance methods in an organizer.
- Can call interactors multiple times inside organizers.
- Can add conditions to interactors in an organizer.
- Allows early success with organizer conditions.
Actor accepts using Interactor classes when using play for a smooth migration. You can use both gems at the same time in your application.