123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::YAMLDuplicationChecker::DuplicationCheckHandler Private

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Psych::TreeBuilder
Instance Chain:
self, Psych::TreeBuilder
Inherits: Psych::TreeBuilder
  • Object
Defined in: lib/rubocop/yaml_duplication_checker.rb

Class Method Summary

Instance Method Summary

Instance Method Details

#end_mapping

[ GitHub ]

  
# File 'lib/rubocop/yaml_duplication_checker.rb', line 20

def end_mapping
  mapping_node = super
  # OPTIMIZE: Use a hash for faster lookup since there can
  # be quite a few keys at the top-level.
  keys = {}
  mapping_node.children.each_slice(2) do |key, _value|
    duplicate = keys[key.value]
    @block.call(duplicate, key) if duplicate
    keys[key.value] = key
  end
  mapping_node
end