Helo
I am new to Ruby (using 1.8.6) and should know if the following functions are available automatically, and if not, then this is the best way to implement it.
I have a Car class. And they have two objects:
car_a and car_b
Is there any way to compare and find which properties differ in one of the objects compared to the other?
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 do
car_a.compare_with(car_b)
should give me:
{:color => 'Blue', :sun_roof => 'false'}
or something like that?
ruby introspection
saurabhj
source share