Class: Tocer::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/tocer/runner.rb

Overview

Generates/updates Table of Contents for files in root path.

Instance Method Summary collapse

Constructor Details

#initialize(writer: Writer.new) ⇒ Runner

Returns a new instance of Runner.



12
13
14
15
# File 'lib/tocer/runner.rb', line 12

def initialize(writer: Writer.new, **)
  super(**)
  @writer = writer
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
# File 'lib/tocer/runner.rb', line 17

def call
  settings.root_dir
          .files(%({#{settings.patterns.join ","}}))
          .each do |path|
            io.puts "  #{path}"
            writer.call path, label: settings.label
          end
end