class RoadForest::Interface::Blob

Public Instance Methods

destination_dir() click to toggle source
# File lib/roadforest/interface/blob.rb, line 6
def destination_dir
  Pathname.new(services.destination_dir)
end
incomplete_path() click to toggle source
# File lib/roadforest/interface/blob.rb, line 22
def incomplete_path
  [path,"incomplete"].join(".")
end
path() click to toggle source
# File lib/roadforest/interface/blob.rb, line 14
def path
  destination_dir.join(sub_path)
end
retrieve() click to toggle source
# File lib/roadforest/interface/blob.rb, line 18
def retrieve
  File::open(path)
end
sub_path() click to toggle source
# File lib/roadforest/interface/blob.rb, line 10
def sub_path
  params.remainder
end
update(incoming) click to toggle source
# 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