module Psych
def self.load yaml, permitted_classes: [Symbol], permitted_symbols: [], aliases: false, filename: nil, fallback: nil, symbolize_names: false, freeze: false, strict_integer: false
similar to `safe_load` except that `Symbol` objects are allowed by default.
Raises a TypeError when `yaml` parameter is NilClass. This method is
Psych.load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
Psych.load("---\n foo: bar") # => {"foo"=>"bar"}
true value, returns symbols for keys in Hash objects (default: strings).
When the optional +symbolize_names+ keyword argument is set to a
end
ex.message # => "(file.txt): found character that cannot start any token"
ex.file # => 'file.txt'
rescue Psych::SyntaxError => ex
Psych.load("--- `", filename: "file.txt")
begin
Psych.load("---\n - a\n - b") # => ['a', 'b']
Psych.load("--- a") # => 'a'
Example:
Raises a Psych::SyntaxError when a YAML syntax error is detected.
the specified +fallback+ return value, which defaults to +false+.
is raised while parsing. If +yaml+ is empty, it returns
+filename+ will be used in the exception message if any exception
provided, the object contained in the first document will be returned.
Load +yaml+ in to a Ruby data structure. If multiple documents are
##
def self.load yaml, permitted_classes: [Symbol], permitted_symbols: [], aliases: false, filename: nil, fallback: nil, symbolize_names: false, freeze: false, strict_integer: false safe_load yaml, permitted_classes: permitted_classes, permitted_symbols: permitted_symbols, aliases: aliases, filename: filename, fallback: fallback, symbolize_names: symbolize_names, freeze: freeze, strict_integer: strict_integer end