Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] prototype-0.0.0

Reply
Thread Tools

[ANN] prototype-0.0.0

 
 
ara.t.howard@noaa.gov
Guest
Posts: n/a
 
      07-12-2006

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/Prototy...ed_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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57