NAME

   prototype.rb

URIS

   http://codeforpeople.com/lib/ruby/
   http://rubyforge.org/projects/codeforpeople/

SYNOPSIS

   prototype.rb implements the prototype design pattern

     http://en.wikipedia.org/wiki/Prototype-based_programming

   for ruby

WHY

   prototype based programming can look very nice ;-)

EXAMPLES

   ~ > cat samples/a.rb
   require 'prototype'

   singleton = Prototype.new{
     @a, @b = 40, 2

     def answer() @a + @b end
   }

   p singleton.answer


   ~ > ruby samples/a.rb
   42




   ~ > cat samples/b.rb
   require 'prototype'

   DB = Prototype.new{
     host 'localhost'
     port 4242

     def connect() p [host, port] end
   }

   p DB.host
   p DB.port
   DB.connect


   ~ > ruby samples/b.rb
   "localhost"
   4242
   ["localhost", 4242]


DOCS

   see

     lib/*rb
     samples/*rb



comments and patches welcome!

enjoy!


-a
-- 
suffering increases your inner strength.  also, the wishing for suffering
makes the suffering disappear.
- h.h. the 14th dali lama