Skip to content

Instantly share code, notes, and snippets.

@britishtea
Created February 21, 2012 15:12
Show Gist options
  • Save britishtea/1876974 to your computer and use it in GitHub Desktop.
Save britishtea/1876974 to your computer and use it in GitHub Desktop.
Scopes in Ruby
module Namespace
class String
def a
String.inspect
end
def b
::String.inspect
end
end
end
instance = Namespace::String.new
instance.a # => "Lol::String"
instance.b # => "String"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment