Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Ruby Refresher #222

wants to merge 3 commits into from

Conversation

BDCraven
Copy link

No description provided.

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."

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."

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants