Class: OsCtl::Repo::Downloader::Base
- Inherits:
-
Object
- Object
- OsCtl::Repo::Downloader::Base
- Defined in:
- lib/osctl/repo/downloader/base.rb
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
protected
Returns the value of attribute repo.
Instance Method Summary collapse
- #connect ⇒ Object protected
- #index_uri ⇒ Object protected
-
#initialize(repo) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(repo) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/osctl/repo/downloader/base.rb', line 5 def initialize(repo) @repo = repo end |
Instance Attribute Details
#repo ⇒ Object (readonly, protected)
Returns the value of attribute repo.
11 12 13 |
# File 'lib/osctl/repo/downloader/base.rb', line 11 def repo @repo end |
Instance Method Details
#connect ⇒ Object (protected)
13 14 15 16 17 18 19 20 |
# File 'lib/osctl/repo/downloader/base.rb', line 13 def connect(&) uri = URI(repo.url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.scheme == 'https') http.start(&) rescue SystemCallError => e raise NetworkError, e end |
#index_uri ⇒ Object (protected)
22 23 24 |
# File 'lib/osctl/repo/downloader/base.rb', line 22 def index_uri URI(repo.index_url) end |