class Ramdo::Cleaner

Public Class Methods

clean_up(disk) click to toggle source
# File lib/ramdo/cleaner.rb, line 3
def self.clean_up(disk)
  Dir.entries(disk.path).each do |dir|
    if dir =~ Store::NAME_PATTERN
      uuid = Regexp.last_match[1]
      timestamp = Regexp.last_match[2].to_i
      if (timestamp + DEFAULTS[:ttl]) < Time.now.utc.to_i
        FileUtils.rm_r File.join(disk.path, dir), :force => true
      end
    end
  end
end