Class: Munge::Function::Write

Inherits:
Object
  • Object
show all
Defined in:
lib/munge/function/write.rb

Instance Method Summary collapse

Constructor Details

#initialize(conglomerate:, reporter:, manager:, destination:) ⇒ Write

Returns a new instance of Write.



4
5
6
7
8
9
10
11
12
# File 'lib/munge/function/write.rb', line 4

def initialize(conglomerate:, reporter:, manager:, destination:)
  @items = conglomerate.items
  @router = conglomerate.router
  @processor = conglomerate.processor
  @reporter = reporter
  @manager = manager
  @vfs = destination
  @written_paths = []
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/munge/function/write.rb', line 14

def call
  @reporter.start

  @items
    .reject { |item| item.route.nil? }
    .each { |item| render_and_write(item) }

  @reporter.done

  @manager.written_routes
end