instance method
Gem::ConfigFile#load_file
load_file(filename)
lib/rubygems/config_file.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/config_file.rb, line 365
def load_file(filename)
yaml_errors = [ArgumentError]
return {} unless filename && !filename.empty? && File.exist?(filename)
begin
config = self.class.load_with_rubygems_config_hash(File.read(filename))
if config.keys.any? {|k| k.to_s.gsub(%r{https?:\/\/}, "").include?(": ") }
warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
return {}
else
return config
end
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
#last_update_check=
#rubygems_api_key
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0