Class: Bundler::Settings::Mirror
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/mirror.rb |
Overview
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.
Constant Summary
-
DEFAULT_FALLBACK_TIMEOUT =
# File 'lib/bundler/mirror.rb', line 630.1
Class Method Summary
- .new(uri = nil, fallback_timeout = 0) ⇒ Mirror constructor
Instance Attribute Summary
- #fallback_timeout rw
- #fallback_timeout=(timeout) rw
- #uri rw
- #uri=(uri) rw
- #valid? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(uri = nil, fallback_timeout = 0) ⇒ Mirror
# File 'lib/bundler/mirror.rb', line 67
def initialize(uri = nil, fallback_timeout = 0) self.uri = uri self.fallback_timeout = fallback_timeout @valid = nil end
Instance Attribute Details
#fallback_timeout (rw)
[ GitHub ]# File 'lib/bundler/mirror.rb', line 65
attr_reader :uri, :fallback_timeout
#fallback_timeout=(timeout) (rw)
[ GitHub ]# File 'lib/bundler/mirror.rb', line 82
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 (rw)
[ GitHub ]# File 'lib/bundler/mirror.rb', line 65
attr_reader :uri, :fallback_timeout
#uri=(uri) (rw)
[ GitHub ]
#valid? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/mirror.rb', line 98
def valid? return false if @uri.nil? return @valid unless @valid.nil? false end
Instance Method Details
#==(other)
[ GitHub ]# File 'lib/bundler/mirror.rb', line 94
def ==(other) !other.nil? && uri == other.uri && fallback_timeout == other.fallback_timeout end
#validate!(probe = nil)
[ GitHub ]# File 'lib/bundler/mirror.rb', line 104
def validate!(probe = nil) @valid = false if uri.nil? if @valid.nil? @valid = fallback_timeout == 0 || (probe || TCPSocketProbe.new).replies?(self) end self end