Skip to content

Instantly share code, notes, and snippets.

@cupakromer
Created February 6, 2013 23:13
Show Gist options
  • Save cupakromer/4726770 to your computer and use it in GitHub Desktop.
Save cupakromer/4726770 to your computer and use it in GitHub Desktop.
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