Class: VimRecovery::Command
- Inherits:
-
Object
- Object
- VimRecovery::Command
- Defined in:
- lib/vim_recovery/command.rb
Defined Under Namespace
Instance Method Summary collapse
- #each_swapfile(&block) ⇒ Object
-
#initialize(paths, options = {}) ⇒ Command
constructor
A new instance of Command.
- #patterns ⇒ Object
Constructor Details
#initialize(paths, options = {}) ⇒ Command
Returns a new instance of Command.
5 6 7 8 |
# File 'lib/vim_recovery/command.rb', line 5 def initialize(paths, = {}) @paths = paths @options = end |
Instance Method Details
#each_swapfile(&block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 |