Class: RoadForest::Interface::Blob
Instance Attribute Summary
Attributes inherited from Application
#services
Instance Method Summary
collapse
Methods inherited from Application
#canonical_host, #default_content_engine, #dispatcher, #initialize
Instance Method Details
#destination_dir ⇒ Object
6
7
8
|
# File 'lib/roadforest/interface/blob.rb', line 6
def destination_dir
Pathname.new(services.destination_dir)
end
|
#incomplete_path ⇒ Object
22
23
24
|
# File 'lib/roadforest/interface/blob.rb', line 22
def incomplete_path
[path,"incomplete"].join(".")
end
|
#path ⇒ Object
14
15
16
|
# File 'lib/roadforest/interface/blob.rb', line 14
def path
destination_dir.join(sub_path)
end
|
#retrieve ⇒ Object
18
19
20
|
# File 'lib/roadforest/interface/blob.rb', line 18
def retrieve
File::open(path)
end
|
#sub_path ⇒ Object
10
11
12
|
# File 'lib/roadforest/interface/blob.rb', line 10
def sub_path
params.remainder
end
|
#update(incoming) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/roadforest/interface/blob.rb', line 26
def update(incoming)
File::open(incomplete_path, "w") do |file|
incoming.each do |chunk|
file.write(chunk)
end
end
Pathname.new(incomplete_path).rename(path)
return nil
end
|