Created
May 1, 2016 06:42
-
-
Save bazz1tv/adde9e5c6f8cdc22cb299672672b99e5 to your computer and use it in GitHub Desktop.
Ruby class definition scoping
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 A | |
a = "DERP" | |
@a = "BARF" | |
@@a = "FETUS" | |
puts a | |
puts @a | |
end | |
class A | |
puts @a | |
begin | |
puts a | |
rescue Exception => e | |
puts e.message | |
end | |
end | |
class B < A | |
puts "#{@a} -- blank" | |
puts @@a | |
end | |
class C < B | |
puts @@a | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment