class Dessert
attr_accessor :name, :calories
def initialize(name,calories)
@name=name
@calories=Float(calories)
end
def healthy?
@calories<200
end
def delicious?
true
end
end
class JellyBean < Dessert
attr_accessor :flavor
def initialize (name,calories,flavor)
@flavor=flavor
end
def delicious?
flavor=='black licorice'?false:true
end
def to_s
"Name: #{@name}"
end
end
icecream=Dessert.new('ice',100)
p icecream
p icecream.healthy?
p icecream.delicious?
ras=JellyBean.new('ice',100,'black licorice')
p ras
p ras.delicious?
puts ras
Y2xhc3MgRGVzc2VydAphdHRyX2FjY2Vzc29yIDpuYW1lLCA6Y2Fsb3JpZXMKCWRlZiBpbml0aWFsaXplKG5hbWUsY2Fsb3JpZXMpCglAbmFtZT1uYW1lCglAY2Fsb3JpZXM9RmxvYXQoY2Fsb3JpZXMpCgllbmQKCglkZWYgaGVhbHRoeT8KCUBjYWxvcmllczwyMDAKCWVuZAoJCglkZWYgZGVsaWNpb3VzPwoJdHJ1ZQoJZW5kCmVuZAoKY2xhc3MgSmVsbHlCZWFuIDwgRGVzc2VydCAKYXR0cl9hY2Nlc3NvciA6Zmxhdm9yCglkZWYgaW5pdGlhbGl6ZSAobmFtZSxjYWxvcmllcyxmbGF2b3IpCglAZmxhdm9yPWZsYXZvcgoJZW5kCglkZWYgZGVsaWNpb3VzPwoJZmxhdm9yPT0nYmxhY2sgbGljb3JpY2UnP2ZhbHNlOnRydWUKCWVuZAoJZGVmIHRvX3MKCSJOYW1lOiAje0BuYW1lfSIKCWVuZAplbmQKaWNlY3JlYW09RGVzc2VydC5uZXcoJ2ljZScsMTAwKQpwIGljZWNyZWFtCnAgaWNlY3JlYW0uaGVhbHRoeT8KcCBpY2VjcmVhbS5kZWxpY2lvdXM/CnJhcz1KZWxseUJlYW4ubmV3KCdpY2UnLDEwMCwnYmxhY2sgbGljb3JpY2UnKQpwIHJhcwpwIHJhcy5kZWxpY2lvdXM/CnB1dHMgcmFz