leah blogs

November 2004

19nov2004 · Needle Extras

Jamis Buck announced Needle-Extras 1.0.0 today on ruby-talk.

It’s a “collection of additional services that may be used with the Needle dependency injection container for Ruby”.

If you want to do anything that goes further than the most basic use of Needle, I strongly recommend you to get it and look at the sources. You can learn lots from them.

So far, Needle-Extras consists of:

  • AttrInject, “an implementation of dependency injection that uses declared interfaces to determine dependencies.” (Yeah, see “attr_inject: A step towards interface injection”. My idea. :-))

    I think it is an good example of how to implement a Needle::Pipeline::Element.

  • Multicast, a service that “allows you to easily broadcast messages to a specified set of objects. It is, in essence, a kind of observer pattern, with the observers being given to the multicaster when it is created. Events are then sent to the observers by invoking methods on the multicaster.”

    Read this if you want to define services that behave as if they were in the core Needle library.

  • RequireLibrary, “a mini-framework for registering service libraries with Needle so that they can be imported into other projects with a minimum of headache.”

    This shows how a general-purpose Needle utility can be done.

I have definitely some use for all of them…

NP: Phish—While My Guitar Gently Weeps

Copyright © 2004–2022