I'm up against something I don't quite understand.
Here's the class I've created, and the driver code I'm running to test my method:
class Dog < Array
def breathing?
self.length > 1
end
end
the_dog = Dog.new(["Arf", "Woof"])
puts the_dog.breathing?
# true
the_dog.shift
puts the_dog.breathing?
# false
How come, when I call #shift on the_dog, the_dog stops breathing?
the_dog.lengthisn't greater than 1. Did you want to use>=? Also, inheriting from core classes might not go well (sadly), use instance variables.