Skip to content

Instantly share code, notes, and snippets.

Created July 10, 2016 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/aaa07b0c7b660ddee72c236176d2240e to your computer and use it in GitHub Desktop.
Save anonymous/aaa07b0c7b660ddee72c236176d2240e to your computer and use it in GitHub Desktop.
simple ruby file instance variables and parameter
class Animal
attr_accessor :name, :what_animal, :breed
def report(personality)
puts "#{@name} is a #{@what_animal}."
puts "#{@name} has a #{personality.breed} personality."
#so why am I setting my variable = parameter?
#My thesis is that I do this when I deal with only one instance...
#am I right?
@breed = personality
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment