Method: Psych.safe_load_file

Defined in:
lib/psych.rb

.safe_load_file(filename, **kwargs) ⇒ Object

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.



676
677
678
679
680
# File 'lib/psych.rb', line 676

def self.safe_load_file filename, **kwargs
  File.open(filename, 'r:bom|utf-8') { |f|
    self.safe_load f, filename: filename, **kwargs
  }
end