On Monday 26 October 2009 19:06:38 J. Daniel Schmidt wrote: > On Monday 26 October 2009 17:51:16 Martin Vidner wrote: > > KNOWN BUGS: > > - See this query for a complete bug list: > > Registration raises an error (did not use the latest code). > You can workaround this by applying the attached patch. > > > Ciao, > Daniel >
The right way to fix it would be first to update plugins/registration/test/unit/registration_test.rb and reproduce the bug by passing a non-Hash. Then add the safeguard code and make sure the test pass. Anyway, how that situation happens? that it receives data that is not a Hash? Another minor detail. I suggest you use obj.is_a?(MyClass) instead of obj.class == MyClass What you are doing is equivalent to obj.instance_of?(MyClass) or testing if the class of the object is exactly Hash. However obj.is_a?(MyClass) determines whether obj is a Hash or any subclass of it, which is more close to what you are looking for (testing whether the object acts like a hash) (the 100% correct way would be to see if the object respond to some Hash-like methods, but that would be too much). Still, I am concerned on how that code would get anything that is not a Hash or nil. -- Duncan Mac-Vicar P. - Engineering Manager, YaST SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
