refactor: separate polymorphic functions#1433
Merged
Conversation
bf4
commented
Jan 19, 2024
lib/jsonapi/utils.rb
Outdated
|
|
||
| module JSONAPI | ||
| module Utils | ||
| extend self |
Collaborator
Author
There was a problem hiding this comment.
👀 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.
bf4
commented
Jan 19, 2024
lib/jsonapi/utils.rb
Outdated
| @polymorphic_types_lookup ||= build_polymorphic_types_lookup | ||
| end | ||
|
|
||
| def build_polymorphic_types_lookup |
Collaborator
Author
There was a problem hiding this comment.
now refactoring the way we build the polymorphic lookup doesn't add any interface to the JSONAPI::Relationship nor JSONAPI::Resource
12 tasks
lgebhardt
added a commit
that referenced
this pull request
Apr 18, 2024
* refactor: lookup polymorphic types only once * refactor: polymorphic lookups to utility module * refactor: separate polymorphic functions * Refactor into PolymorphicTypesLookup --------- Co-authored-by: lgebhardt <larry@cerebris.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracted from https://github.com/cerebris/jsonapi-resources/pull/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: