Created
March 27, 2010 11:27
-
-
Save mrorii/345956 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 Hoge | |
| def initialize(state, foo) | |
| @state = state | |
| @foo = foo | |
| end | |
| def state=(new_state) | |
| @state = new_state | |
| end | |
| def print | |
| puts "@state is #{@state} and @foo is #{@foo}" | |
| end | |
| end | |
| h = Hoge.new("aho", 1) | |
| h.print #=> @state is aho and @foo is 1 | |
| h.state = "baka" # 8 行目の state= を呼ぶ | |
| h.print #=> @state is baka and @foo is 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment