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?(uri) ⇒ Boolean

Returns:

  • (Boolean)

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

def self.remote?(uri)
  uri =~ %r{file://}
end

Instance Method Details

#download(uri) ⇒ Object


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

def download(uri)
  raise 'URI must begin with "file://"' unless uri.start_with? 'file://'
  File.open(uri.split('file://').last)
end

#upload(file) ⇒ Object


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

def upload(file)
  "file://#{file.path}"
end