Module: Defining, Installing, and Using

Current version of my cheat sheet.
Will post at my web site shortly,
with any feedback that comes my way.

Module File

filename: .rb
example: functions.rb

Contents

module FUNCTIONS
def some_function(argument, …)

end
module_function :some_function
# ^^^ You specify a name (a symbol)
end

Flat Install

Copy to site_ruby/
example: /your/ruby/1.8.4/lib/ruby/site_ruby/1.8

Usage:
require ‘functions’
include FUNCTIONS

Nested Install

Copy to site_ruby//
example: /your/ruby/1.8.4/lib/ruby/site_ruby/1.8/etc

Usage:
require ‘etc/functions’
include FUNCTIONS