Created
March 31, 2016 01:45
-
-
Save rightgo09/2916de8b9e27ead2f9a711c7a1eab6fa 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 Hoge | |
def get_v | |
@@v ||= 123 | |
end | |
class << self | |
def inc_v | |
@@v ||= 0 | |
@@v += 1 | |
end | |
end | |
end | |
Hoge.new.get_v #=> 123 | |
Hoge.inc_v #=> 124 | |
Hoge.new.get_v #=> 124 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment