module RuboCop::YAMLDuplicationChecker

Find duplicated keys from YAML. @api private

Public Class Methods

check(yaml_string, filename, &on_duplicated) click to toggle source
# 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