Created
November 17, 2014 11:03
-
-
Save jheg/61e2961150e564d92ca3 to your computer and use it in GitHub Desktop.
getters and setters
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
# how does this differ from ... | |
def name=(new_name) | |
@name = new_name | |
end | |
object.name("Bob") | |
# this | |
def name(new_name) | |
@name = new_name | |
end | |
object.name = "Bob" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment