Class: VagrantVbguest::DownloadBase
- Inherits:
-
Object
- Object
- VagrantVbguest::DownloadBase
- Defined in:
- lib/vagrant-vbguest/download.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#downloader ⇒ Object
readonly
Returns the value of attribute downloader.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #cleanup ⇒ Object
- #download! ⇒ Object
-
#initialize(source, destination, options = nil) ⇒ DownloadBase
constructor
A new instance of DownloadBase.
Constructor Details
#initialize(source, destination, options = nil) ⇒ DownloadBase
Returns a new instance of DownloadBase.
6 7 8 9 10 11 12 13 14 |
# File 'lib/vagrant-vbguest/download.rb', line 6 def initialize(source, destination, =nil) @downloader = nil @source = source @destination = destination if File.directory?(destination) @destination = File.join(destination, "vbguest_download_#{Time.now.to_i.to_s}") end @ui = [:ui] end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
4 5 6 |
# File 'lib/vagrant-vbguest/download.rb', line 4 def destination @destination end |
#downloader ⇒ Object (readonly)
Returns the value of attribute downloader.
4 5 6 |
# File 'lib/vagrant-vbguest/download.rb', line 4 def downloader @downloader end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
4 5 6 |
# File 'lib/vagrant-vbguest/download.rb', line 4 def source @source end |
Instance Method Details
#cleanup ⇒ Object
20 21 22 23 24 25 |
# File 'lib/vagrant-vbguest/download.rb', line 20 def cleanup if destination && File.exist?(destination) @ui.info I18n.t("vagrant_vbguest.download.cleaning") File.unlink(destination) end end |
#download! ⇒ Object
16 17 18 |
# File 'lib/vagrant-vbguest/download.rb', line 16 def download! raise NotImplementedError end |