On Feb 2, 2007, at 11:22 PM, Edward Summers wrote:
On Feb 2, 2007, at 10:51 PM, Erik Hatcher wrote:
Ruby experts - know how I can code Solr::Connection to work like
this without an explicit method? (I'm still a Ruby newbie)
What purpose does this block passing serve?
Well, first and foremost, because it looks cool and seems to be Ruby-
esque.
It also provides a specific scope for a connection, rather than it
being possible for it to leak out (as an instance variable could).
It hides the details of the Connection constructor also (maybe to
cache instanced keyed by Solr URL?).
But, it really doesn't serve much other purpose than to get me
experimenting with cooler Ruby features.
solrshell, regardless of the Connection do .. end block thing, will
evolve into something quite slick. Here's a PyLucene shell that Otis
pointed me to: <http://public.dev.nuxeo.com/~ben/plush/>. Wow!
Erik