Interesting. Is there a particular kind of use that inspired you to  
write this module? Or is it just that you'd rather condense four lines  
of attribute assignment into one?

On May 3, 2005, at 11:56 PM, John W. Long wrote:

> This is the first public release of a very, very small project I've  
> been developed at work. I call it Updateable. By mixing in the  
> Updateable module into a class you can easily update the attributes of  
> the class with a hash:
>
>   require 'updateable'
>
>   class TestObject
>     include Updateable
>
>     attr_accessor :a, :b, :c
>
>     def initialize(options = {})
>       update(options)
>     end
>   end
>
>   o = TestObject.new(:a => 1, :b => 2, :c => 3)
>   puts "#{o.a}#{o.b}#{o.c}" #=> '123'
>
>   o.update(:a => 'a', :b => 'b', :c => 'c')
>   puts "#{o.a}#{o.b}#{o.c}" #=> 'abc'
>
> Download:
> http://johnwlong.com/downloads/iblp-mixins-0.0.3/lib/updateable.rb
>
> Tests:
> http://johnwlong.com/downloads/iblp-mixins-0.0.3/test/unit/ 
> updateable_test.rb
>
> Updateable is currently part of another small project which can be  
> downloaded here:
>
> http://johnwlong.com/downloads/iblp-mixins-0.0.3.tgz
>
> --
> John Long
> http://wiseheartdesign.com
>
>
>

Francis Hwang
http://fhwang.net/