123456789_123456789_123456789_123456789_123456789_

Class: Bundler::Settings::MirrorConfig

Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/mirror.rb

Overview

Class used to parse one configuration line

Gets the configuration line and the value.

This object provides a `update_mirror` method
used to setup the given mirror value.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(config_line, value) ⇒ MirrorConfig

[ GitHub ]

  
# File 'lib/bundler/mirror.rb', line 121

def initialize(config_line, value)
  uri, fallback =
    config_line.match(%r{\Amirror\.(all|.+?)(\.fallback_timeout)?\/?\z}).captures
  @fallback = !fallback.nil?
  @all = false
  if uri == "all"
    @all = true
  else
    @uri = URI(uri).absolute? ? Settings.normalize_uri(uri) : uri
  end
  @value = value
end

Instance Attribute Details

#all?Boolean (readonly)

[ GitHub ]

  
# File 'lib/bundler/mirror.rb', line 134

def all?
  @all
end

#uri (rw)

[ GitHub ]

  
# File 'lib/bundler/mirror.rb', line 119

attr_accessor :uri, :value

#value (rw)

[ GitHub ]

  
# File 'lib/bundler/mirror.rb', line 119

attr_accessor :uri, :value

Instance Method Details

#update_mirror(mirror)

[ GitHub ]

  
# File 'lib/bundler/mirror.rb', line 138

def update_mirror(mirror)
  if @fallback
    mirror.fallback_timeout = @value
  else
    mirror.uri = Settings.normalize_uri(@value)
  end
end