Skip to content

Instantly share code, notes, and snippets.

@hopsoft
Created January 11, 2011 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hopsoft/774118 to your computer and use it in GitHub Desktop.
Save hopsoft/774118 to your computer and use it in GitHub Desktop.
Namespace - Illustrates how to use modules for namespacing
# create a namespace to avoid naming collisions
module Example
class String
def length
100
end
end
end
# usage
String.new.length # => 0
Example::String.new.length # => 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment