summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2022-09-15 17:48:52 -0700
committerAaron Patterson <tenderlove@ruby-lang.org>2022-09-15 17:50:04 -0700
commitbca7d2c54942205e9364f8b0c0a1948fd1442ec8 (patch)
tree05540bbcd6b782a71ac46e0633e460b345624088 /lib
parent251289ba835294d454f20cd0e75bfa1ccb618e6b (diff)
downloadpsych-bca7d2c54942205e9364f8b0c0a1948fd1442ec8.tar.gz
Convert some of Parser#parse to Ruby
This commit just converts some of the parse method to Ruby
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/parser.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/psych/parser.rb b/lib/psych/parser.rb
index 39bc828..2181c73 100644
--- a/lib/psych/parser.rb
+++ b/lib/psych/parser.rb
@@ -48,5 +48,18 @@ module Psych
@handler = handler
@external_encoding = ANY
end
+
+ ###
+ # call-seq:
+ # parser.parse(yaml)
+ #
+ # Parse the YAML document contained in +yaml+. Events will be called on
+ # the handler set on the parser instance.
+ #
+ # See Psych::Parser and Psych::Parser#handler
+
+ def parse yaml, path = yaml.respond_to?(:path) ? yaml.path : "<unknown>"
+ _native_parse @handler, yaml, path
+ end
end
end