-
Notifications
You must be signed in to change notification settings - Fork 532
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
refactor: separate polymorphic functions #1433
Conversation
lib/jsonapi/utils.rb
Outdated
|
||
module JSONAPI | ||
module Utils | ||
extend self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 named Utils
because my intention is for this to be a collection of functions which may not have an obvious theme or place on their own.
Called extend self
instead of module_function
to declare that this module is intended to hold functions, not to be included anywhere.
lib/jsonapi/utils.rb
Outdated
@polymorphic_types_lookup ||= build_polymorphic_types_lookup | ||
end | ||
|
||
def build_polymorphic_types_lookup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now refactoring the way we build the polymorphic lookup doesn't add any interface to the JSONAPI::Relationship nor JSONAPI::Resource
* refactor: lookup polymorphic types only once * refactor: polymorphic lookups to utility module * refactor: separate polymorphic functions * Refactor into PolymorphicTypesLookup --------- Co-authored-by: lgebhardt <[email protected]>
Extracted from #1424
since it hints at a general usefulness of having a dedication function
module for handling polymorphic lookups.
All Submissions:
New Feature Submissions:
Bug fixes and Changes to Core Features:
Test Plan:
Reviewer Checklist: