Last active
December 21, 2015 15:10
-
-
Save toddseller/9e65e3cbb8322c855b38 to your computer and use it in GitHub Desktop.
Defining the bored method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog | |
def initialize(name, breed) | |
@name = name | |
@breed = breed | |
@hungry = false | |
@bored = false | |
end | |
def feed | |
puts "You just fed #{@name}, the #{@breed}." | |
@hungry = false | |
@bored = true | |
end | |
def bored | |
puts "You just played fetch with #{@name}, the #{@breed}." | |
@bored = false | |
end | |
end | |
puppy = Dog.new('Atticus', 'German Shepherd') | |
puppy.feed | |
>> "You just fed Atticus, the German Shepherd." | |
puppy.bored | |
>> "You just played fetch with Atticus, the German Shepherd." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment