Skip to content
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

Add actionsFromClass method for use in extended Policy classes #48

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

chrisalley
Copy link
Collaborator

@chrisalley chrisalley commented Jul 31, 2023

Introduces a new method that can be added to the constructor of the extended policy class that will add all class methods to the actions map:

this.actionsFromClass.apply(this)

Using apply(this) allows us to use the scope of the extended policy within Policy, otherwise this will refer to the base Policy class, meaning that we'll only see methods such as can, add, and copy, which is not what we want.

Open to any suggestions for simplifying this further.

Addresses #43

@chrisalley chrisalley requested a review from johno July 31, 2023 11:55
@chrisalley chrisalley force-pushed the add-actions-from-class-method branch from 37ffbb0 to 134d9f4 Compare July 31, 2023 12:04
Copy link
Collaborator

@johno johno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪧

@chrisalley chrisalley merged commit 932639c into main Aug 1, 2023
3 checks passed
@chrisalley chrisalley deleted the add-actions-from-class-method branch August 1, 2023 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants