Last active
April 3, 2018 04:46
-
-
Save mykiy/3e18fc42ba6ef0ccc7eba66084730ed5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Work | |
| def name=(name) #which works like a setter method of class | |
| @name = name | |
| end | |
| def name #which works like a gettter method, gets the name from current object scope | |
| @name | |
| end | |
| end | |
| job = Work.new #which creates the new instance object | |
| job.name = "Ruby learning" #which sets the name | |
| job.name #Which returns the name the instance variable holds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment