Class: NameFindCommand

Inherits:
FindCommand show all
Defined in:
lib/justy/commands/name_find_command.rb

Instance Attribute Summary

Attributes inherited from FindCommand

#files

Instance Method Summary collapse

Methods inherited from FindCommand

#initialize, #output

Constructor Details

This class inherits a constructor from FindCommand

Instance Method Details

#run(folder) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/justy/commands/name_find_command.rb', line 7

def run(folder)
  Dir.glob(folder + '/**/*', File::FNM_DOTMATCH).each do |full_filename|
    next if File.directory?(full_filename)
    key = File.basename(full_filename)
    if @files.has_key? key
      @files[key].push full_filename
    else
      @files[key] = [full_filename]
    end
  end
  output()
end