Skip to content

Commit

Permalink
Merge pull request #493 from mame/load_file-should-use-load-instead-o…
Browse files Browse the repository at this point in the history
…f-safe_load

Make YAML.load_file use YAML.load instead of safe_load
  • Loading branch information
tenderlove authored May 21, 2021
2 parents 3fabcb9 + f8a5e51 commit 38e4b51
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/psych.rb
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ def self.unsafe_load_file filename, **kwargs
self.unsafe_load f, filename: filename, **kwargs
}
end
class << self; alias :load_file :unsafe_load_file; end

###
# Safely loads the document contained in +filename+. Returns the yaml contained in
Expand All @@ -587,7 +586,17 @@ def self.safe_load_file filename, **kwargs
self.safe_load f, filename: filename, **kwargs
}
end
class << self; alias load_file safe_load_file end

###
# 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 load for options.
def self.load_file filename, **kwargs
File.open(filename, 'r:bom|utf-8') { |f|
self.load f, filename: filename, **kwargs
}
end

# :stopdoc:
def self.add_domain_type domain, type_tag, &block
Expand Down

0 comments on commit 38e4b51

Please sign in to comment.