Hack hack hack...

An open journal-- some of it written for you, but most of it is for me.

Namespacing

Say my friend has a sister named Sue, and so do I. How can I tell them apart in a conversation? By using their last name. The last name is the namespace.

Modules define a namespace, a sandbox in which your methods and constants can play without having to worry about being stepped on by other methods and constants.

1
2
3
class Dog
  Species = ["Poodle"]
 end

Dog::Species => Species is a Constant within the Dog class. Species could be a class it could be a module, but it is a child of Dog.

Comments