Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Psych.safe_load_file
safe_load_file(filename, **kwargs)
ext/psych/lib/psych.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/ext/psych/lib/psych.rb, line 658
def self.safe_load_file filename, **kwargs
File.open(filename, 'r:bom|utf-8') { |f|
self.safe_load f, filename: filename, **kwargs
}
end
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 false. See safe_load for options.