diff --git a/stdlib/psych/0/psych.rbs b/stdlib/psych/0/psych.rbs index 808f0d41c..c085c2c0d 100644 --- a/stdlib/psych/0/psych.rbs +++ b/stdlib/psych/0/psych.rbs @@ -400,4 +400,56 @@ module Psych # %a{annotate:rdoc:copy:Psych.unsafe_load} def self.unsafe_load: (String yaml, ?filename: String | _ToStr | _ToS?, ?fallback: untyped, ?symbolize_names: bool, ?freeze: bool, ?strict_integer: bool) -> untyped + + # + # Safely loads the document contained in `filename`. Returns the yaml contained + # in `filename` as a Ruby object, or if the file is empty, it returns the + # specified `fallback` return value, which defaults to `nil`. See safe_load for + # options. + # + %a{annotate:rdoc:copy:Psych.safe_load_file} + def self.safe_load_file: (path, ?permitted_classes: Array[Class], ?permitted_symbols: Array[Symbol], ?aliases: bool, ?fallback: untyped, ?symbolize_names: bool, ?freeze: bool) -> untyped + + # + # Load the document contained in `filename`. Returns the yaml contained in + # `filename` as a Ruby object, or if the file is empty, it returns the specified + # `fallback` return value, which defaults to `false`. + # + # NOTE: This method *should not* be used to parse untrusted documents, such as + # YAML documents that are supplied via user input. Instead, please use the + # safe_load_file method. + # + %a{annotate:rdoc:copy:Psych.unsafe_load_file} + def self.unsafe_load_file: (path, ?fallback: untyped, ?symbolize_names: bool, ?freeze: bool) -> untyped + + class Exception < ::RuntimeError + end + + class SyntaxError < ::Psych::Exception + attr_reader file: String? + attr_reader line: Integer? + attr_reader column: Integer? + attr_reader offset: Integer? + attr_reader problem: String? + attr_reader context: String? + + # + # + def initialize: (?String? file, ?Integer? line, ?Integer? column, ?Integer? offset, ?String? problem, ?String? context) -> void + end + + class BadAlias < ::Psych::Exception + end + + class DisallowedClass < ::Psych::Exception + end end