-
-
Save notch8-old/1529050 to your computer and use it in GitHub Desktop.
Working with instance vars issue
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
module B | |
def rara | |
@rara ||= Array.new | |
end | |
def rara=(value) | |
@rara = value | |
end | |
end | |
class A | |
include B | |
def show | |
puts @rara | |
end | |
def add | |
rara.push('hi') | |
end | |
end | |
foo = A.new | |
foo.add | |
foo.show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment