[ANN] prototype-0.0.0

Discussion in 'Ruby' started by ara.t.howard@noaa.gov, Jul 12, 2006.

  1. Guest

    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
     
    , Jul 12, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. June Lee
    Replies:
    2
    Views:
    808
    Jim Cobban
    Apr 13, 2008
  2. Replies:
    3
    Views:
    82
    Martin DeMello
    Jul 14, 2006
  3. Replies:
    9
    Views:
    196
    Thomas 'PointedEars' Lahn
    May 26, 2006
  4. Replies:
    3
    Views:
    271
  5. javascript fish
    Replies:
    0
    Views:
    175
    javascript fish
    Oct 11, 2008
Loading...

Share This Page