Helo,
I am pretty new to Ruby (using 1.8.6) and need to know whether the following functionality is available automatically and if not, which would be the best method to implement it.
I have class Car. And have two objects:
car_a and car_b
Is there any way I could do a compare and find what properties differ in one of the objects as compared to the other one?
For example,
car_a.color = 'Red'
car_a.sun_roof = true
car_a.wheels = 'Bridgestone'
car_b.color = 'Blue'
car_b.sun_roof = false
car_b.wheels = 'Bridgestone'
then doing a
car_a.compare_with(car_b)
should give me:
{:color => 'Blue', :sun_roof => 'false'}
or something to that effect?