def name=(value)
if value == ""
raise "Name can't be blank!"
end
@name = value
end
def age=(value)
if value < 0
raise "An age of #{value} isn't valid!"
end
class Dog
def name(value)
if value == ""
raise "Name can't be blank!"
end
@name = value
end
def age=(value)
if value < 0
raise "An age of #{value} isn't valid!"
end
@age = value
end
def move(destination)
puts "#{@name} runs to the #{destination}."
end
def talk
puts "#{@name} says Bark!"
end
def report_age
puts "#{@name} is #{@age} years old."
end
end
dog = Dog.new
dog.name("Daisy")
dog.age = 30
dog.report_age
dog.talk
dog.move("bad")