Find file
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (23 sloc) 419 Bytes
class Dessert
attr_accessor :name, :calories
def initialize(name, calories)
@name = name
@calories = 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
super(name, calories)
end
def delicious?
!(flavor =~ /\Ablack licorice\z/i)
end
end