Class: Evm::RemoteFile
- Inherits:
-
Object
- Object
- Evm::RemoteFile
- Defined in:
- lib/evm/remote_file.rb
Instance Method Summary collapse
- #download(path) ⇒ Object
-
#initialize(url, options = {}) ⇒ RemoteFile
constructor
A new instance of RemoteFile.
Constructor Details
#initialize(url, options = {}) ⇒ RemoteFile
Returns a new instance of RemoteFile.
5 6 7 8 9 10 |
# File 'lib/evm/remote_file.rb', line 5 def initialize(url, = {}) @url = url = @file = [:file] ||= File @uri = [:uri] ||= URI end |
Instance Method Details
#download(path) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/evm/remote_file.rb', line 12 def download(path) unless @file.exist?(path) @file.open(path, 'w') do |file| file.write(@uri.parse(@url).read) end end end |