Class: EXEL::Providers::LocalFileProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/exel/providers/local_file_provider.rb

Overview

The default remote provider. Doesn’t actually upload and download files to and from remote storage, but rather just works with local files.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.remote?(value) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/exel/providers/local_file_provider.rb', line 18

def self.remote?(value)
  value.is_a?(RemoteValue)
end

Instance Method Details

#download(remote_value) ⇒ Object



12
13
14
15
16
# File 'lib/exel/providers/local_file_provider.rb', line 12

def download(remote_value)
  scheme = remote_value.uri.scheme
  raise "Unsupported URI scheme '#{scheme}'" unless scheme == 'file'
  File.open(remote_value.uri.path)
end

#upload(file) ⇒ Object



8
9
10
# File 'lib/exel/providers/local_file_provider.rb', line 8

def upload(file)
  RemoteValue.new(URI("file://#{File.absolute_path(file)}"))
end