fork download
  1. class Dessert
  2. def initialize(name,calories)
  3. @name=name
  4. @calories=Float(calories)
  5. end
  6.  
  7. def healthy?
  8. calories<200
  9. end
  10.  
  11. def delicious?
  12. end
  13. end
  14. icecream=Dessert.new('ice',100)
  15. p icecream
  16. p icecream.healthy?
Runtime error #stdin #stdout 0s 4760KB
stdin
Standard input is empty
stdout
#<Dessert:0xa16786c @name="ice", @calories=100.0>