We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3482ad1 commit b535700Copy full SHA for b535700
lib/psych/handlers/document_stream.rb
@@ -18,6 +18,18 @@ def end_document implicit_end = !streaming?
18
@last.implicit_end = implicit_end
19
@block.call pop
20
end
21
+
22
+ def end_mapping
23
+ mapping = pop
24
+ keys = {}
25
+ mapping.children.each_slice(2) do |(key_scalar, _)|
26
+ next if key_scalar.is_a?(Psych::Nodes::Sequence) or key_scalar.is_a?(Psych::Nodes::Alias) or key_scalar.is_a?(Psych::Nodes::Mapping)
27
+ key = key_scalar.value
28
+ raise Psych::Exception, "Duplicate key #{key} exists on this level" if keys.key? key
29
+ keys[key] = nil
30
+ end
31
+ mapping
32
33
34
35
0 commit comments