Module: ModalSupport::StateEquivalent

Defined in:
lib/modalsupport/mixins/state_equivalent.rb

Instance Method Summary collapse

Instance Method Details

#==(obj) ⇒ Object



3
4
5
# File 'lib/modalsupport/mixins/state_equivalent.rb', line 3

def ==(obj)
  test_equal(obj)
end

#===(obj) ⇒ Object



11
12
13
# File 'lib/modalsupport/mixins/state_equivalent.rb', line 11

def ===(obj)
  test_equal(obj)
end

#eql?(obj) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/modalsupport/mixins/state_equivalent.rb', line 7

def eql?(obj)
  test_equal(obj)
end

#hashObject



15
16
17
18
19
20
21
22
# File 'lib/modalsupport/mixins/state_equivalent.rb', line 15

def hash
  h = 0
  self.instance_variables.each do |var|
    v = self.instance_variable_get(var)
    h ^= v.hash unless v.nil?
  end
  h
end