Open
Conversation
2c6c793 to
0dfe187
Compare
krsyoung
reviewed
Oct 13, 2023
| def initialize(events:, time_window: 1.week, color_scheme: "neutral") | ||
| raise ArgumentError unless events.is_a?(ActiveRecord::Relation) | ||
| raise ArgumentError unless time_window.is_a?(Integer) | ||
| validate_arguments(events, time_window) |
Contributor
There was a problem hiding this comment.
Nice way to try things up. I've not really thought about this type of validation before but seems to make sense and definitely better than including it in each file.
Thoughts on leveraging super as an alternative implementation? Not sure it is better ...
In this implementation, I think it would be nice to have named arguments so that the method signature would be:
validate_arguments(events: events, time_window: time_window)
Author
There was a problem hiding this comment.
Was able to implement both the suggestions. Much cleaner now 🚀
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.
Uh oh!
There was an error while loading. Please reload this page.