Closed timriley closed 6 years ago
this looks fine to me btw, probably someone will come up with a better idea in future but nothing comes into my mind atm
Stopping by to say thanks, as I hit this problem earlier today, and while debugging I ended up realizing that it was fixed in the latest release :smiley: thanks for the great work everyone!
So @GustavoCaso and I have been talking about addressing #75 and making it possible to provide replacement for "internal" transaction steps (i.e. steps which are backed by instance methods only). The inability to do this feels to me the only big gap we left after moving to class-based transactions, and given an increased in the number of people using container-less transactions, it would be good to get it in place.
@GustavoCaso, I've taken a different approach to what you've done recently, and I think it might work out.
This PR makes one big change in the way we understand steps:
with:
option (where "external" means the step operation can be resolved from a container or provided whenever the transaction is initializedThen, when an "internal" step ("internal" meaning a step implanted by an instance method only) has a matching object passed to the initializer, that object fully replaces whatever was previously provided by the instance method
This is a breaking change:
with:
will need to be provided if anyone was previously relying on the implicit behaviour of the step name also being used to try and find the step operation in a container. Now that we have class-based transactions, my hunch is that not many people will be doing this. Anyone seriously working with containers will have longer container identifiers and will already havewith:
options in every place they need.step :foo
and then passfoo:
to the initializer, and have a the#foo
instance method still run and callsuper
to call the operation object passed in asfoo:
. However, I don't think many people would be doing this, and they can still keep this same behaviour by defining the step asstep :foo, with: :foo
.So I don't think the breaking changes here are too big, and I think the result is actually a much clearer separation of behaviours.
Plus, I'm much happier to merge something like this in given how small a change it ended up being.
What do you think?
@flash-gordon would be great to get your input, too.