diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2022-09-19 08:44:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-19 08:44:16 -0700 |
commit | af50867197df587ef4007fedf1736c4faa7cbf64 (patch) | |
tree | abcdf5c7466fb973720436c87a37438510337378 /lib | |
parent | a565e1fcec3dad4de7e753b9c3e113c7ed1a22a4 (diff) | |
parent | bca7d2c54942205e9364f8b0c0a1948fd1442ec8 (diff) | |
download | psych-af50867197df587ef4007fedf1736c4faa7cbf64.tar.gz |
Merge pull request #580 from ruby/more-ruby
Convert some of Parser#parse to Ruby
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/parser.rb | 13 |
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 |