Skip to content

Instantly share code, notes, and snippets.

@jacegu
Created January 18, 2011 18:09
Show Gist options
  • Save jacegu/784864 to your computer and use it in GitHub Desktop.
Save jacegu/784864 to your computer and use it in GitHub Desktop.
An example to show the use of :: the namespace resolving operator in ruby.
class MyClass
CONSTANT = 'hello world'
end
puts MyClass::CONSTANT
begin
puts MyClass.CONSTANT
rescue NoMethodError
puts 'With dot notation we are sending a message to class MyClass'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment