Class: Bosh::Director::StaleFileKiller

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/stale_file_killer.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ StaleFileKiller

Returns a new instance of StaleFileKiller.



6
7
8
# File 'lib/bosh/director/stale_file_killer.rb', line 6

def initialize(dir)
  @dir = dir
end

Instance Method Details

#killObject



10
11
12
13
14
# File 'lib/bosh/director/stale_file_killer.rb', line 10

def kill
  Dir[File.join(@dir, '*')].select {|entry|
    (Time.now - File.mtime(entry)) > 3600
  }.each { |entry| FileUtils.rm(entry) }
end