In Files

  • bundler/mirror.rb

Class/Module Index [+]

Quicksearch

Bundler::Settings::Mirror

A mirror

Contains both the uri that should be used as a mirror and the

fallback timeout which will be used for probing if the mirror
replies on time or not.

Attributes

fallback_timeout[R]
uri[R]

Public Class Methods

new(uri = nil, fallback_timeout = 0) click to toggle source
 
               # File bundler/mirror.rb, line 66
def initialize(uri = nil, fallback_timeout = 0)
  self.uri = uri
  self.fallback_timeout = fallback_timeout
  @valid = nil
end
            

Public Instance Methods

==(other) click to toggle source
 
               # File bundler/mirror.rb, line 93
def ==(other)
  !other.nil? && uri == other.uri && fallback_timeout == other.fallback_timeout
end
            
fallback_timeout=(timeout) click to toggle source
 
               # File bundler/mirror.rb, line 81
def fallback_timeout=(timeout)
  case timeout
  when true, "true"
    @fallback_timeout = DEFAULT_FALLBACK_TIMEOUT
  when false, "false"
    @fallback_timeout = 0
  else
    @fallback_timeout = timeout.to_i
  end
  @valid = nil
end
            
uri=(uri) click to toggle source
 
               # File bundler/mirror.rb, line 72
def uri=(uri)
  @uri = if uri.nil?
    nil
  else
    Bundler::URI(uri.to_s)
  end
  @valid = nil
end
            
valid?() click to toggle source
 
               # File bundler/mirror.rb, line 97
def valid?
  return false if @uri.nil?
  return @valid unless @valid.nil?
  false
end
            
validate!(probe = nil) click to toggle source
 
               # File bundler/mirror.rb, line 103
def validate!(probe = nil)
  @valid = false if uri.nil?
  if @valid.nil?
    @valid = fallback_timeout == 0 || (probe || TCPSocketProbe.new).replies?(self)
  end
  self
end