[ANN] prototype-0.0.0

A

ara.t.howard

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top