------art_89642_20518440.1182718117095
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Chris Carter and I threw together a simple gem to help create nested
hierarchies (without relying on constructors).  Sample usage:

  require 'lay'
  car  ar.lay( :color "Red", :driver Driver.lay( :name "Bob" ) )

Is anyone aware of something out there that already does this (in Ruby)?

Note that in the above example Car and Driver might not have constructors
defined.  As you've probably guessed the example simply instantiates a Car,
sets its 'color' attr to "Red", and sets its 'driver' attr to a new Driver
instance (whose 'name' attr is set to "Bob").

The idea was largely borrowed from groovy.  I've used the groovy way of
doing this extensively and have found it to be particularly useful in test
cases, when you need to construct nested objects to use as test input.

Please let us know if we're reinventing the wheel.  Otherwise, please do a
"gem install lay" and try it out and give us feedback if you think it might
be useful to you.

Other features:
- Also pass parameters to constructors
  - Car.lay( ["Jetta", "V6"], :color "Red" )
- Set member vars that don't have attr's defined
  - Car.lay( :_color "Red" )
  - This sets the @color member variable
  - We should probably change it to use :@color instead of :_color

--Craig

------art_89642_20518440.1182718117095--