module Logica::ComparableByState

Public Instance Methods

==(other) click to toggle source
# File lib/logica/comparable_by_state.rb, line 3
def ==(other)
  other.instance_of?(self.class) && other.state == state
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/logica/comparable_by_state.rb, line 8
def hash
  state.hash
end
state() click to toggle source
# File lib/logica/comparable_by_state.rb, line 12
def state
  attributes
end

Private Instance Methods

attributes() click to toggle source
# File lib/logica/comparable_by_state.rb, line 18
def attributes
  instance_variables.each_with_object({}) do |name, h|
    h[name[1..-1].to_sym] = instance_variable_get(name)
  end
end