Module: AnnoTranslate::YamlUtils

Defined in:
lib/yaml_utils.rb

Class Method Summary collapse

Class Method Details

.compare_yaml_hash(cf1, cf2, context = []) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/yaml_utils.rb', line 3

def self.compare_yaml_hash(cf1, cf2, context = [])
  cf1.each do |key, value|
    unless cf2.key?(key)
      puts "Missing key : #{key} in path #{context.join(".")}"
      next
    end

    value2 = cf2[key]
    if (value.class != value2.class)
      puts "Key value type mismatch : #{key} in path #{context.join(".")}"
      next
    end

    if value.is_a?(Hash)
      compare_yaml_hash(value, value2, (context + [key]))
      next
    end

    # if (value != value2)
    #   puts "Key value mismatch : #{key} in path #{context.join(".")}"
    # end
  end
end