Class: YamlLint::Linter::KeyOverlapDetector

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

Overview

Detects duplicate keys in Psych parsed data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKeyOverlapDetector

Setup class variables



133
134
135
136
137
138
139
140
# File 'lib/yamllint/linter.rb', line 133

def initialize
  @seen_keys = Set.new
  @key_components = []
  @last_key = ['']
  @overlapping_keys = Set.new
  @complex_type = []
  @array_positions = []
end

Instance Attribute Details

#overlapping_keysObject (readonly)

Returns the value of attribute overlapping_keys.



130
131
132
# File 'lib/yamllint/linter.rb', line 130

def overlapping_keys
  @overlapping_keys
end

Instance Method Details

#parse(psych_parse_data) ⇒ Object

Get the data and send it off for duplicate key validation



143
144
145
146
# File 'lib/yamllint/linter.rb', line 143

def parse(psych_parse_data)
  data_start = psych_parse_data.handler.root.children[0]
  parse_recurse(data_start)
end