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.
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/bundler/mirror.rb', line 116 def initialize(config_line, value) uri, fallback = config_line.match(%r{^mirror\.(all|.+?)(\.fallback_timeout)?\/?$}).captures @fallback = !fallback.nil? @all = false if uri == "all" @all = true else @uri = Settings.normalize_uri(uri) end @value = value end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
114 115 116 |
# File 'lib/bundler/mirror.rb', line 114 def uri @uri end |
#value ⇒ Object
Returns the value of attribute value.
114 115 116 |
# File 'lib/bundler/mirror.rb', line 114 def value @value end |
Instance Method Details
#all? ⇒ Boolean
129 130 131 |
# File 'lib/bundler/mirror.rb', line 129 def all? @all end |
#update_mirror(mirror) ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/bundler/mirror.rb', line 133 def update_mirror(mirror) if @fallback mirror.fallback_timeout = @value else mirror.uri = Settings.normalize_uri(@value) end end |