Class: Bosh::Director::StaleFileKiller
- Defined in:
- lib/bosh/director/stale_file_killer.rb
Instance Method Summary collapse
-
#initialize(dir) ⇒ StaleFileKiller
constructor
A new instance of StaleFileKiller.
- #kill ⇒ Object
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
#kill ⇒ Object
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 |