Sha256: 4e94f96edd9d9a4c8d51df175c8076372d893be9b1e865490b233cb00912e50c
Contents?: true
Size: 568 Bytes
Versions: 8
Compression:
Stored size: 568 Bytes
Contents
require 'active_support/core_ext/hash' class YamlProperties::Diff def initialize a, b @hash_a, @hash_b = read(a, b) unless same? raise ArgumentError.new(error_message) end end private def error_message "Following keys are not present in both files '#{key_diff}'" end def key_diff (keys_a - keys_b) + (keys_b - keys_a) end def keys_a @hash_a.keys end def keys_b @hash_b.keys end def same? key_diff.empty? end def read *files files.map do |f| YAML.load File.read(f) end end end
Version data entries
8 entries across 8 versions & 2 rubygems