Class: CodeKeeper::Finder

Inherits:
Object
  • Object
show all
Defined in:
lib/code_keeper/finder.rb

Overview

Find ruby files and manage the list of files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ Finder

Returns a new instance of Finder.



8
9
10
11
12
13
14
# File 'lib/code_keeper/finder.rb', line 8

def initialize(paths)
  @file_paths = search_recursively(paths.uniq).map do |path|
    raise ::CodeKeeper::TargetFileNotFoundError.new(path) unless File.exist?(path)

    path if FileTest.file?(path) && File.extname(path) == '.rb'
  end.compact
end

Instance Attribute Details

#file_pathsObject (readonly)

Returns the value of attribute file_paths.



6
7
8
# File 'lib/code_keeper/finder.rb', line 6

def file_paths
  @file_paths
end