Last active
August 29, 2015 14:01
-
-
Save nwjsmith/266e26c4814da8c257fa to your computer and use it in GitHub Desktop.
psych.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/psych/handlers/document_stream.rb b/lib/psych/handlers/document_stream.rb | |
index e429993..25d10fb 100644 | |
--- a/lib/psych/handlers/document_stream.rb | |
+++ b/lib/psych/handlers/document_stream.rb | |
@@ -18,5 +18,19 @@ module Psych | |
@block.call pop | |
end | |
end | |
+ | |
+ class StrictDocumentStream < DocumentStream | |
+ def end_mapping | |
+ mapping = pop | |
+ keys = [] | |
+ mapping.children.each_slice(2) do |(key_scalar, _)| | |
+ key = key_scalar.value | |
+ fail "whale" if keys.include? key | |
+ keys << key | |
+ end | |
+ mapping | |
+ end | |
+ end | |
+ | |
end | |
end |
diff --git a/lib/psych/handlers/document_stream.rb b/lib/psych/handlers/document_stream.rb
index e429993..25d10fb 100644
--- a/lib/psych/handlers/document_stream.rb
+++ b/lib/psych/handlers/document_stream.rb
@@ -18,5 +18,19 @@ module Psych
@block.call pop
end
end
+
- class StrictDocumentStream < DocumentStream
-
def end_mapping
-
mapping = pop
-
keys = []
-
mapping.children.each_slice(2) do |(key_scalar, _)|
-
key = key_scalar.value
-
fail "whale" if keys.include? key
-
keys << key
-
end
-
mapping
-
end
- end
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
diff --git a/lib/psych/handlers/document_stream.rb b/lib/psych/handlers/document_stream.rb
index e429993..25d10fb 100644
--- a/lib/psych/handlers/document_stream.rb
+++ b/lib/psych/handlers/document_stream.rb
@@ -18,5 +18,19 @@ module Psych
@block.call pop
end
end
+
end
end