class Evm::RemoteFile

Public Class Methods

new(url, options = {}) click to toggle source
# File lib/evm/remote_file.rb, line 5
def initialize(url, options = {})
  @url = url
  @options = options
  @file = options[:file] ||= File
  @uri = options[:uri] ||= URI
end

Public Instance Methods

download(path) click to toggle source
# 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