Class: YamlDuplicateChecker::Checker Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml_duplicate_checker.rb

Overview

This class is abstract.

Use Checker#dup_list returns duplicate yaml key list

Yaml duplicate check class

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Checker

Returns a new instance of Checker.



12
13
14
15
16
# File 'lib/yaml_duplicate_checker.rb', line 12

def initialize(root)
  @key_list = Hash.new { |h, v| h[v] = [] }
  @root = root
  check
end

Instance Method Details

#dup_listObject



18
19
20
# File 'lib/yaml_duplicate_checker.rb', line 18

def dup_list
  @dup_list ||= @key_list.select { |_, v| v.size > 1 }
end