Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Assign expected and promised keys to Action subclass #72
Currently when an
class AnAction extend LightService::Action expects :expected_key executed do |context| # do stuff end end class AnActionSubclass executed do |context| # do stuff context.expected_key # raises an error end end
This PR will allow the above to work.
I discovered this a couple of weeks ago. I was able to eliminate the need for subclassing by going with a different (cleaner) design of Action and Context hash so I'm not sure how useful this is.
However, I made the PR because it might be surprising to others that
@jpmoral, thank you for submitting this PR.
The reason I opted to use class methods for the actions was to limit inheritance. With inheritance there is an "inferred" state that I tried to avoid.
Would you be OK if I did not merge this PR? I know you worked on it, that's why I feel bad about it.