A r t i c l e s
Navigation

Note: This Wiki is
outdated, personal views
may have changed.
L505 A.I. bot is dead
long live THX 1138

M a i n P a g e

D i r e c t o r y

Units vs Ruby Modules


Modern Pascal uses units to keep functions and data structures inside its own namespace. Ruby can use modules. Modules don't require an instance of a class to be created, so they are like a namespace.
module test

  def test1
    puts 'this is test 1'
  end

  def test2
    puts 'this is test 2'
  end

  def test3
    puts 'this is test 3'
  end

end 

include test

# no instance needs to be created
test.test1
test.test2
test.test3

No complaints really. We can do good old procedural coding by avoiding using nonsensical classes for everything (well technically the functions are part of the self class that you can't see, but for creeps sake I'm not gonna get purist about it)

About
Note: This Wiki is outdated, personal views may have changed.

This wiki contains info on life, health, humans, nature, programming, database, fads, paradigms, poems, principles, theories.

Articles may contain statements which some may find helpful and encouraging, or even discouraging.

Beware, I believe in the Grand Justice system.
_ _ _