Module: RuboCop::YAMLDuplicationChecker Private

Defined in:
lib/rubocop/yaml_duplication_checker.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Find duplicated keys from YAML.

Defined Under Namespace

Classes: DuplicationCheckHandler

Class Method Summary collapse

Class Method Details

.check(yaml_string, filename, &on_duplicated) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
# File 'lib/rubocop/yaml_duplication_checker.rb', line 7

def self.check(yaml_string, filename, &on_duplicated)
  handler = DuplicationCheckHandler.new(&on_duplicated)
  parser = Psych::Parser.new(handler)
  parser.parse(yaml_string, filename)
  parser.handler.root.children[0]
end