ruby in 100 minutes good_morning method issue
- by user2525947
I have been doing the Ruby in 100 minutes on the JumpStart labs website, and encountered a problem during part 5.
I was asked to create a good_morning method that would print out a greeting such as 'Happy Monday, it's the 130 day of 2013'. Here is my current program:
class PersonalChef
def good_morning
today = Date.today.strftime("%A")
day_of_year = Date.today.yday
puts "Happy#{today}! It is the #{day_of_year} day of year."
return self
end
def make_toast(color)
puts " Making your toast #{color}!"
return self
end
def make_milkshake(flavor)
puts " Making a #{flavor} milkshake!"
return self
end
def make_eggs(quantity)
puts " Making you #{quantity} eggs!"
return self
end
end
when I try to run the program load on irb( 'personal_chef.rb', frank = PersonalChef.new, frank.make_milkshake('chocolate'), etc, everything works fine until I try to type frank.good_morning into irb, which gives the following error message:
NameError: uninitialized constant PersonalChef :: Date
from personal_chef.rb:5: in good_morning from (irb):3 from /bin/irb:12:in ''
Any help or information to help me solve this issue would be greatly appreciated.
Thanks for your time!