Class: Bundler::Settings::MirrorConfig
- Inherits:
-
Object
- Object
- Bundler::Settings::MirrorConfig
- 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.
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #all? ⇒ Boolean
-
#initialize(config_line, value) ⇒ MirrorConfig
constructor
A new instance of MirrorConfig.
- #update_mirror(mirror) ⇒ Object
Constructor Details
#initialize(config_line, value) ⇒ MirrorConfig
Returns a new instance of MirrorConfig.
121 122 123 124 125 126 127 128 129 130 131 132 |
# 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 = Bundler::URI(uri).absolute? ? Settings.normalize_uri(uri) : uri end @value = value end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
119 120 121 |
# File 'lib/bundler/mirror.rb', line 119 def uri @uri end |
#value ⇒ Object
Returns the value of attribute value.
119 120 121 |
# File 'lib/bundler/mirror.rb', line 119 def value @value end |
Instance Method Details
#all? ⇒ Boolean
134 135 136 |
# File 'lib/bundler/mirror.rb', line 134 def all? @all end |
#update_mirror(mirror) ⇒ Object
138 139 140 141 142 143 144 |
# 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 |