Class: Todoloo::FileScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/todoloo/file_scanner.rb

Overview

File scanner for finding todos

Instance Method Summary collapse

Constructor Details

#initialize(pattern, excludes: [], trace: nil) ⇒ FileScanner

Returns a new instance of FileScanner.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/todoloo/file_scanner.rb', line 6

def initialize(pattern, excludes: [], trace: nil)
  @parsers = Concurrent::Hash.new

  @pattern = pattern

  @excludes = excludes

  @trace_output = case trace
  when nil, false
    nil
  when true
    $stderr
  when String
    File.open(trace, "w")
  else
    raise ArgumentError, "Invalid value #{trace} for argument trace"
  end
end

Instance Method Details

#scanTodoloo::TaskList

Returns:



26
27
28
# File 'lib/todoloo/file_scanner.rb', line 26

def scan
  Todoloo::TaskList.new.add(scan_files)
end