class VimRecovery::Command
Public Class Methods
new(paths, options = {})
click to toggle source
# File lib/vim_recovery/command.rb, line 5 def initialize(paths, options = {}) @paths = paths @options = options end
Public Instance Methods
each_swapfile() { |swapfile| ... }
click to toggle source
# File lib/vim_recovery/command.rb, line 19 def each_swapfile &block @paths.each do |path| path = path.chomp '/' path_patterns = patterns.map { |swp| "#{path}/#{swp}" } Dir.glob(path_patterns, File::FNM_DOTMATCH).each do |filename| next unless File.file? filename begin swapfile = VimRecovery::Swapfile.open filename next unless swapfile.valid_block0? yield swapfile ensure swapfile.close end end end end
patterns()
click to toggle source
# File lib/vim_recovery/command.rb, line 10 def patterns @patterns ||= if @options[:recursive] SWAPFILES.map { |swp| "**/#{swp}" } else SWAPFILES end end