Skip to content

Instantly share code, notes, and snippets.

@toddseller
Last active December 21, 2015 15:11
Show Gist options
  • Save toddseller/102d50c73a1d243cc78f to your computer and use it in GitHub Desktop.
Save toddseller/102d50c73a1d243cc78f to your computer and use it in GitHub Desktop.
Defining the hungry method
class Dog
def initialize(name, breed)
@name = name
@breed = breed
@hungry = false
end
def feed
puts "You just fed #{@name}, the #{@breed}."
end
end
puppy = Dog.new('Atticus', 'German Shepherd')
puppy.feed
>> "You just fed Atticus, the German Shepherd."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment