Created
March 21, 2009 16:16
-
-
Save bradediger/82888 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
def set_my_ivar | |
@my_ivar = 'set' | |
end | |
class A | |
attr_reader :my_ivar | |
def test_the_setting | |
set_my_ivar | |
end | |
end | |
a = A.new | |
a.test_the_setting | |
puts "a: #{a.my_ivar.inspect}" | |
puts "main: #{@my_ivar.inspect}" | |
# a: "set" | |
# main: nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment