Class: VimRecovery::Command::Clean

Inherits:
VimRecovery::Command show all
Defined in:
lib/vim_recovery/command/clean.rb

Instance Method Summary collapse

Methods inherited from VimRecovery::Command

#each_swapfile, #initialize, #patterns

Constructor Details

This class inherits a constructor from VimRecovery::Command

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
# File 'lib/vim_recovery/command/clean.rb', line 3

def run
  each_swapfile do |swapfile|
    next if swapfile.modified? || swapfile.still_running?

    puts swapfile.path if @options[:verbose]
    swapfile.close
    File.unlink swapfile
  end
end