Method: Utils::Finder#initialize

Defined in:
lib/utils/finder.rb

#initialize(opts = {}) ⇒ Finder

Returns a new instance of Finder.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/utils/finder.rb', line 17

def initialize(opts = {})
  @args  = opts[:args] || {}
  @roots = discover_roots(opts[:roots])
  @config = opts[:config] || Utils::ConfigFile.new
  if @args[?l] || @args[?L]
    @pattern = nil
  else
    pattern_opts = opts.subhash(:pattern) | {
      :cset  => @args[?a],
      :icase => @args[?i] != ?n,
    }
    @pattern = choose(@args[?p], pattern_opts)
  end
  @paths  = []
  reset_index
end