Sha256: 5b39e74a0b6e9e9cf316a62e35a0a9b858b8817e231eda2e86488170383a48ea

Contents?: true

Size: 659 Bytes

Versions: 1

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

require_relative 'acts_as_delta'

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

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

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

      def left
        @value
      end

      def right
        nil
      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/left.rb