From 26135312f61014967ef223dd16ad6577ebd9c5d8 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 15 Sep 2022 17:48:52 -0700 Subject: [ruby/psych] Convert some of Parser#parse to Ruby This commit just converts some of the parse method to Ruby https://github.com/ruby/psych/commit/bca7d2c549 --- ext/psych/lib/psych/parser.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ext/psych/lib') diff --git a/ext/psych/lib/psych/parser.rb b/ext/psych/lib/psych/parser.rb index 39bc8289be..2181c730e5 100644 --- a/ext/psych/lib/psych/parser.rb +++ b/ext/psych/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 : "" + _native_parse @handler, yaml, path + end end end -- cgit v1.2.3