Module: ValueEquality
- Included in:
- BlockedStalledChange, SprintIssueChangeData, Status
- Defined in:
- lib/jirametrics/value_equality.rb
Overview
Perform an equality check based on whether the two objects have the same values
Instance Method Summary collapse
Instance Method Details
#==(other) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jirametrics/value_equality.rb', line 5 def ==(other) return false unless other.class == self.class code = lambda do |object| names = object.instance_variables if object.respond_to? :value_equality_ignored_variables ignored_variables = object.value_equality_ignored_variables names.reject! { |n| ignored_variables.include? n } end names.map { |variable| instance_variable_get variable } end code.call(self) == code.call(other) end |
#eql?(other) ⇒ Boolean
20 21 22 |
# File 'lib/jirametrics/value_equality.rb', line 20 def eql?(other) self == other end |