Created
July 10, 2016 21:24
-
-
Save anonymous/aaa07b0c7b660ddee72c236176d2240e to your computer and use it in GitHub Desktop.
simple ruby file instance variables and parameter
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 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