May 29, 2006...4:47 pm

ruby.design.patterns

Jump to Comments

Some of the patterns are built in Ruby library, like Singleton so we can simply use it like that:

require 'singleton'

class QueenMotherBee
   include Singleton
end

qbee1 = QueenMotherBee.instance
qbee2 = QueenMotherBee.instance

print qbee1, " = ", qbee2, "n"

Singleton is a module :.. some info about using modules.

There are some interesting resources on web about patterns in Ruby, like Object-Oriented Design Libraries or Example Design Patterns In Ruby in Ruby Garden.

1 Comment


Leave a Reply