Skip to content

Instantly share code, notes, and snippets.

@bazz1tv
Created May 1, 2016 06:42
Show Gist options
  • Save bazz1tv/adde9e5c6f8cdc22cb299672672b99e5 to your computer and use it in GitHub Desktop.
Save bazz1tv/adde9e5c6f8cdc22cb299672672b99e5 to your computer and use it in GitHub Desktop.
Ruby class definition scoping
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