[ANN] Facets / Multiton 2.0.0

Discussion in 'Ruby' started by Trans, Mar 9, 2007.

  1. Trans

    Trans Guest

    Facets / Multiton 2.0.0

    Implementation of the Multiton Design Pattern

    by Ara T Howard and Trans

    http://facets.rubyforge.org


    [ S Y N O P S I S ]

    Multiton is similar to the Singleton, but rather than a single object
    it pools a cached set corresponding to the initialization parameters,
    ie. initialize the class again with the same parameters and get the
    same object.


    [ I N S T A L L ]

    Please note Facets/Multiton is already included in the complete Facets
    package. You do not need this if you already have Facets installed.
    You can install this library via gem or tarball. Eg.

    gem install facets_multition

    or

    wget http://rubyforge.org/frs/download.php/18259/facets_multiton-2.0.0.tgz
    tar -xvzf facets_multiton-2.0.0.tgz
    cd facets_multiton-2.0.0
    sudo ruby setup.rb


    [ C R E D I T ]

    Ara T. Howard (Original Code)
    Trans (Improvements)


    [ L I C E N S E ]

    Facets/Multiton
    Copyright (c) 2005-2007 Ara T. Howard, Trans
    All Right Reserved

    Distributed under the terms of the Ruby/GPL license.
     
    Trans, Mar 9, 2007
    #1
    1. Advertising

  2. Trans

    Guest

    On Fri, 9 Mar 2007, Trans wrote:

    > [ C R E D I T ]
    >
    > Ara T. Howard (Original Code)
    > Trans (Improvements)

    ^^^^^^^^^^^^
    ^^^^^^^^^^^^
    ^^^^^^^^^^^^ undoubtedly, the code was bit rotting, but what?

    cheers.

    -a
    --
    be kind whenever possible... it is always possible.
    - the dalai lama
     
    , Mar 9, 2007
    #2
    1. Advertising

  3. Trans

    Trans Guest

    Re: Facets / Multiton 2.0.0

    On Mar 8, 9:14 pm, wrote:
    > On Fri, 9 Mar 2007, Trans wrote:
    > > [ C R E D I T ]

    >
    > > Ara T. Howard (Original Code)
    > > Trans (Improvements)

    >
    > ^^^^^^^^^^^^
    > ^^^^^^^^^^^^
    > ^^^^^^^^^^^^ undoubtedly, the code was bit rotting, but what?



    Most notably and interface change. From the docs:

    # == Previous Behavior
    #
    # In previous versions of Multiton the #new method was made
    # private and #instance was used in its stay --just like Singleton.
    # But this has proved less desirable for Multiton since Multitions can
    # have multiple instances, not just one.
    #
    # So instead Multiton now defines #create as a private alias of
    # the original #new method (just in case it is needed) and then
    # defines #new to handle the multiton, and #instance is provided
    # as an alias for it.
    #
    # If you must have the old behavior, all you need do is re-alias
    # #new to #create and privatize it.
    #
    # class SomeMultitonClass
    # include Multiton
    # alias_method :new, :create
    # private :new
    # ...
    # end
    #
    # Then only #instance will be available for creating the Multiton.

    Another example:

    k = begin
    Marshal.dump(k)
    rescue TypeError
    k
    end

    k is the args passed to the initializer, but marshalled to use as a
    hash key for caching.

    Also, I simplied how the METHOD_NEW_HOOK is used so that it is always
    defined.

    Think that's about it.

    T.
     
    Trans, Mar 9, 2007
    #3
    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. Replies:
    0
    Views:
    99
  2. Replies:
    0
    Views:
    88
  3. TRANS

    [ANN] Ruby Facets 0.6.2

    TRANS, Mar 21, 2005, in forum: Ruby
    Replies:
    13
    Views:
    145
    Trans
    Mar 24, 2005
  4. Trans

    [ANN] Ruby Facets 0.6.3

    Trans, Apr 17, 2005, in forum: Ruby
    Replies:
    0
    Views:
    84
    Trans
    Apr 17, 2005
  5. TRANS

    [ANN] Ruby Facets 0.7.2

    TRANS, May 22, 2005, in forum: Ruby
    Replies:
    0
    Views:
    89
    TRANS
    May 22, 2005
Loading...

Share This Page