Created
February 6, 2013 23:13
-
-
Save cupakromer/4726770 to your computer and use it in GitHub Desktop.
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 Test | |
attr_accessor :my_var | |
def set_name(name) | |
self.my_var = name # You must do this using just my_var = name would | |
# create a local variable with the name my_var | |
end | |
def say_hello | |
puts "Hi #{my_var}" # No need to say `self`. It is the implicit receiver | |
# Call order looks like: local var? self.method? super... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment