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)


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

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

Instance Method Details

#download(uri) ⇒ Object



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

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

#upload(file) ⇒ Object



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

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