Class: C3D::Purger

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/c3d/util/purger.rb

Instance Method Summary collapse

Constructor Details

#initialize(blob) ⇒ Purger

Returns a new instance of Purger.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/c3d/util/purger.rb', line 7

def initialize blob
  begin
    dn   = blob[14..-1]
    currently_downloading = Celluloid::Actor[:puller].all
    downloading = currently_downloading.select{|t| t["name"] == dn}.first["id"]
    Celluloid::Actor[:puller].destroy downloading if downloading
    blob_file = File.join(ENV['BLOBS_DIR'], dn)
    if File.exists? blob_file
      File.delete blob_file
    end
  rescue
    return
  end
end