-
Notifications
You must be signed in to change notification settings - Fork 395
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
Ruby Refresher #222
base: master
Are you sure you want to change the base?
Ruby Refresher #222
Conversation
number = 5 | ||
until number.zero? | ||
puts "#{number} #{number == 1 ? 'bottle' : 'bottles'} of beer on the wall, #{number} #{number == 1 ? 'bottle' : 'bottles'} of beer." | ||
puts "Take one down and pass it around, #{(number -= 1) > 0 ? number : 'no more'} #{number == 1 ? 'bottle' : 'bottles'} of beer on the wall." |
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.
Use (number -= 1).positive? instead of (number -= 1) > 0.
Line is too long. [145/100]
end | ||
number = 5 | ||
until number.zero? | ||
puts "#{number} #{number == 1 ? 'bottle' : 'bottles'} of beer on the wall, #{number} #{number == 1 ? 'bottle' : 'bottles'} of beer." |
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.
Line is too long. [136/100]
@@ -155,30 +184,47 @@ def get_domain_name_from_email_address(email) | |||
# 'the lion the witch and the wardrobe' becomes | |||
# 'The Lion the Witch and the Wardrobe' | |||
def titleize_a_string(string) | |||
lowercase_words = ["a", "and", "the"] | |||
string.split.each_with_index.map do |word, index| | |||
lowercase_words.include?(word) && index > 0 ? word : word.capitalize |
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.
Use index.positive? instead of index > 0.
No description provided.