Sha256: 2a0b3288316983a099b79d401239adc41a0b2051a9078e12fabcc0a5ea3a8474
Contents?: true
Size: 483 Bytes
Versions: 9
Compression:
Stored size: 483 Bytes
Contents
# frozen_string_literal: true module Refinements module Shared # Provides functionality for knowing the difference between two whole value objects. module Diff def diff other if other.is_a? self.class to_h.merge(other.to_h) { |_, one, two| [one, two].uniq } .select { |_, diff| diff.size == 2 } else to_h.each.with_object({}) { |(key, value), diff| diff[key] = [value, nil] } end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems