-
Notifications
You must be signed in to change notification settings - Fork 82
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
Sheshtawy #94
base: master
Are you sure you want to change the base?
Sheshtawy #94
Conversation
Add missing tests for deaf grandma
Implement FizBuzz tests
|
||
upper = /[A-Z]+/ | ||
lower = /[A-Z]?[a-z]+/ | ||
bye = /\A(BYE ?){3}\z/ |
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.
These three regular expressions could be extracted to constants, since they are the same every time this method is called.
upper = /[A-Z]+/ | ||
lower = /[A-Z]?[a-z]+/ | ||
bye = /\A(BYE ?){3}\z/ | ||
response = '' |
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 don't think we need this local variable. Below, you conditionally assign different values to it, but you don't do anything else with response
. I'm pretty sure this method will behave the same if you don't have this local variable and just put those three strings in each part of the if
/elsif
/elsif
.
response = 'SPEAK UP SONNY!' | ||
elsif bye.match(input) | ||
response = 'SEE YOU LATER SONNY!' | ||
elsif upper.match(input) |
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.
What if the input matches none of these regular expressions? I think that would happen if there is no letter in the input.
@jaybobo