Module: Rung::ValueObject

Included in:
Definition::Callback, Definition::Step, State
Defined in:
lib/rung/value_object.rb

Overview

Helper module for defining comparable value objects

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ true, false

Returns:

  • (true)

    when other has the same class and equal instance variables

  • (false)

    otherwise


6
7
8
9
10
11
12
13
# File 'lib/rung/value_object.rb', line 6

def ==(other)
  return false if self.class != other.class

  instance_variables.all? do |variable|
    instance_variable_get(variable) ==
      other.send(:instance_variable_get, variable)
  end
end