For a simple struct-like class:
class Tiger attr_accessor :name, :num_stripes end
what is the correct way to implement equality correctly
To test all your instance variables equality at once:
def ==(other) other.class == self.class && other.state == self.state end def state self.instance_variables.map { |variable| self.instance_variable_get variable } end