Sha256: 43cc2c3299fbbbbffbdae69b42b84742fa91b9eafd59441a4e38fa8aee2646e4

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

require_relative 'acts_as_delta'

module HashDeepDiff
  module Delta
    # Representation of the pure right diff
    # i.e element that are missing in the hash on the right of the comparison
    # for example right diff of {} and { a: a } is { a: a }
    class Right
      include Delta::ActsAsDelta

      def to_str
        return "-left#{diff_prefix} = #{right}" unless right.respond_to?(:to_hash)

        right.keys.map do |key|
          self.class.new(path: path + [key], value: right[key])
        end.join("\n").strip
      end

      def left
        nil
      end

      def right
        @value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hash_deep_diff-0.3.3 lib/hash_deep_diff/delta/right.rb