End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::ConfigFile#load_file
load_file(filename)
lib/rubygems/config_file.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/rubygems/config_file.rb, line 345
def load_file(filename)
Gem.load_yaml
yaml_errors = [ArgumentError]
yaml_errors << Psych::SyntaxError if defined?(Psych::SyntaxError)
return {} unless filename && !filename.empty? && File.exist?(filename)
begin
content = Gem::SafeYAML.load(File.read(filename))
unless content.kind_of? Hash
warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
return {}
end
return content
rescue *yaml_errors => e
warn "Failed to load #{filename}, #{e}"
rescue Errno::EACCES
warn "Failed to load #{filename} due to permissions problem."
end
{}
end
No documentation available
See also
#load_api_keys
#really_verbose
#handle_arguments
#rubygems_api_key
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1