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
May 29, 2006 at 6:03 pm
Wow, that’s really cool that Ruby has built-in support for design patterns.