-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Play symbols #71
Comments
An alternative with the current implementation is to define your lambdas before you use them. class PlaceOrder < ApplicationActor
input :order
input :log, default: true
set_current_currency = ->(actor) do
actor.order.currency ||= Current.currency
actor.order.save! if order.changes.any?
end
log_order_creation = ->(actor) do
Logger.log("Order #{actor.order.id} created") if actor.log
end
play set_current_currency,
Orders::Create,
Orders::Notify,
log_order_creation
end Unfortunately this does require defining your |
Oh, indeed, that could be a good alternative for the time being. What I also like about instance methods though is that they have access to inputs, which makes them terser. |
I want to start using this yesterday! 💟 For now I'll settle for the pre-defined lambda locals. |
Released in v3.2 🚀 |
This is a feature idea for using Ruby symbols as
play
arguments.Currently
Sometimes, we need to interlace small actions with larger ones inside a play. For that, instead of giving it actors we can give it lambda actions.
For example :
Ideally
In some cases it could be nice to be able to give it instance methods as well:
The text was updated successfully, but these errors were encountered: