ruby-win32/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
def to_yaml # :nodoc:
    yaml_hash = {}
    yaml_hash[:backtrace] = @hash.key?(:backtrace) ? @hash[:backtrace] :
      DEFAULT_BACKTRACE
    yaml_hash[:benchmark] = @hash.key?(:benchmark) ? @hash[:benchmark] :
      DEFAULT_BENCHMARK
    yaml_hash[:bulk_threshold] = @hash.key?(:bulk_threshold) ?
      @hash[:bulk_threshold] : DEFAULT_BULK_THRESHOLD
    yaml_hash[:sources] = Gem.sources
    yaml_hash[:update_sources] = @hash.key?(:update_sources) ?
      @hash[:update_sources] : DEFAULT_UPDATE_SOURCES
    yaml_hash[:verbose] = @hash.key?(:verbose) ? @hash[:verbose] :
      DEFAULT_VERBOSITY

    keys = yaml_hash.keys.map { |key| key.to_s }
    keys << 'debug'
    re = Regexp.union(*keys)

    @hash.each do |key, value|
      key = key.to_s
      next if key =~ re
      yaml_hash[key.to_s] = value
    end

    yaml_hash.to_yaml
  end
# to_yaml only overwrites things you can't override on the command line.
to_yaml only overwrites things you can't override on the command line.
to_yaml only overwrites things you can ' t override on the command line .
def to_yaml 
    yaml_hash = {}
    yaml_hash[:backtrace] = @hash.key?(:backtrace) ? @hash[:backtrace] :
      DEFAULT_BACKTRACE
    yaml_hash[:benchmark] = @hash.key?(:benchmark) ? @hash[:benchmark] :
      DEFAULT_BENCHMARK
    yaml_hash[:bulk_threshold] = @hash.key?(:bulk_threshold) ?
      @hash[:bulk_threshold] : DEFAULT_BULK_THRESHOLD
    yaml_hash[:sources] = Gem.sources
    yaml_hash[:update_sources] = @hash.key?(:update_sources) ?
      @hash[:update_sources] : DEFAULT_UPDATE_SOURCES
    yaml_hash[:verbose] = @hash.key?(:verbose) ? @hash[:verbose] :
      DEFAULT_VERBOSITY
    keys = yaml_hash.keys.map { |key| key.to_s }
    keys << 'debug'
    re = Regexp.union(*keys)
    @hash.each do |key, value|
      key = key.to_s
      next if key =~ re
      yaml_hash[key.to_s] = value
    end
    yaml_hash.to_yaml
  end
def to_yaml yaml_hash = { } yaml_hash [ :backtrace ] = @hash . key? ( :backtrace ) ? @hash [ :backtrace ] : DEFAULT_BACKTRACE yaml_hash [ :benchmark ] = @hash . key? ( :benchmark ) ? @hash [ :benchmark ] : DEFAULT_BENCHMARK yaml_hash [ :bulk_threshold ] = @hash . key? ( :bulk_threshold ) ? @hash [ :bulk_threshold ] : DEFAULT_BULK_THRESHOLD yaml_hash [ :sources ] = Gem . sources yaml_hash [ :update_sources ] = @hash . key? ( :update_sources ) ? @hash [ :update_sources ] : DEFAULT_UPDATE_SOURCES yaml_hash [ :verbose ] = @hash . key? ( :verbose ) ? @hash [ :verbose ] : DEFAULT_VERBOSITY keys = yaml_hash . keys . map { | key | key . to_s } keys << 'debug' re = Regexp . union ( * keys ) @hash . each do | key , value | key = key . to_s next if key =~ re yaml_hash [ key . to_s ] = value end yaml_hash . to_yaml end
to_yaml only overwrites things you can't override on the command line.
to_yaml only overwrites things you can ' t override on the command line .
# :nodoc: