-
-
Notifications
You must be signed in to change notification settings - Fork 525
refinements: removed from individual cases #697
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
refinements: removed from individual cases #697
Conversation
lib/generator/exercise_case.rb
Outdated
protected | ||
|
||
def underscore(target) | ||
target.underscore |
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.
I think it's best if we still use the refinement within ExerciseCase
. If we don't, we will have to define two separate underscore
methods, one for Fixnum
and one for String
, or define a single underscore
method that switches on the type of the argument. Personally I strongly dislike the latter option.
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.
I agree that switching on type is undesirable.
Getting rid of the refinements in the Case classes is good 👍 and I think what you have here is mergable. I'm not sure continuing to use the function with refinements the way we are here is a good idea. Underscoring a string and underscoring an Integer are two fundamentally different operations performed for different reasons, yet they are called using the same function. Perhaps two different methods is the right way to go, but naming them based on @kotp had some thoughts about this (that I can't find to link to right now.) Edit: What about |
I agree that string underscore and integer underscore are very different operations, and I'm in favor of creating the literal(number) and underscore(string) methods.
|
Is this something you want to do as part of this PR? |
@Insti sure, no problem! I can make the change right now actually. |
da7277a
to
ed73275
Compare
@Insti I think this is good to, but let me know if you want any more changes. |
ed73275
to
74da043
Compare
Looks good, thanks @ajwann |
fixes #645