Module: CloudFile
- Defined in:
- lib/cloud_file.rb,
lib/cloud_file/copy.rb,
lib/cloud_file/file.rb,
lib/cloud_file/address.rb,
lib/cloud_file/service.rb,
lib/cloud_file/services.rb,
lib/cloud_file/cloud_uri.rb,
lib/cloud_file/convertors.rb,
lib/cloud_file/cloud_uri/dsl.rb,
lib/cloud_file/outer_service.rb,
lib/cloud_file/providers/local.rb,
lib/cloud_file/providers/gdrive.rb,
lib/cloud_file/providers/memory.rb,
lib/cloud_file/providers/dropbox.rb,
lib/cloud_file/providers/evernote.rb
Defined Under Namespace
Classes: Address, CloudUri, Convertors, Copy, Dropbox, Evernote, File, Gdrive, Local, Memory, OuterService, Service, Services
Class Method Summary
collapse
Class Method Details
.copy(source, target, format = nil) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/cloud_file.rb', line 34
def copy(source,target,format=nil)
copy = ::CloudFile::Copy.new(:source => source, :target => target, :format => format)
copy.run!
end
|
.files(*args) ⇒ Object
48
49
50
51
|
# File 'lib/cloud_file.rb', line 48
def files(*args)
address = make_address(*args)
address.files
end
|
.make_address(*args) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/cloud_file.rb', line 19
def make_address(*args)
if args.first.kind_of?(::CloudFile::Address)
args.first
elsif args.length == 3
user,provider,loc = *args
::CloudFile::Address.make(:user => user, :provider => provider, :loc => loc)
elsif args.length == 1 && args.first.kind_of?(Hash)
::CloudFile::Address.make(args.first)
elsif args.length == 1 && args.first.kind_of?(String) && args.first =~ /:\/\//
::CloudFile::Address.parse(args.first)
else
raise "can't make address"
end
end
|
.open(*args, &b) ⇒ Object
14
15
16
17
|
# File 'lib/cloud_file.rb', line 14
def open(*args,&b)
address = make_address(*args)
address.open(&b)
end
|
.read(*args) ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/cloud_file.rb', line 53
def read(*args)
res = nil
open(*args) do |f|
res = f.read
end
res
end
|
.write(*args) ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'lib/cloud_file.rb', line 61
def write(*args)
val = args.pop
res = nil
open(*args) do |f|
f.write val
end
res
end
|