Class: Mutante::FileFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/mutante/file_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ FileFinder

Returns a new instance of FileFinder.



3
4
5
# File 'lib/mutante/file_finder.rb', line 3

def initialize(configuration)
  @configuration = configuration
end

Instance Method Details

#call(target = nil) ⇒ Object

Given an optional explicit path (file or directory), returns an array of absolute file paths to analyze.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mutante/file_finder.rb', line 9

def call(target = nil)
  files =
    if target && File.file?(target)
      [File.expand_path(target)]
    elsif target && File.directory?(target)
      glob_in(target, "**/*.rb")
    else
      from_include_globs
    end

  exclude!(files)
end