Sha256: c868d1bdb3f31f3f78a09283b5dbb04fac9b2102e7f6b9c5ebcf4c0ae774f7f1
Contents?: true
Size: 986 Bytes
Versions: 4
Compression:
Stored size: 986 Bytes
Contents
module Munge class Runner def initialize(items:, router:, alterant:, writer:, reporter:, destination:) @items = items @router = router @alterant = alterant @writer = writer @reporter = reporter @write_manager = Munge::WriteManager.new(driver: File) @destination = destination end def write @items .reject { |item| item.route.nil? } .each { |item| render_and_write(item) } end private def render_and_write(item) relpath = @router.filepath(item) abspath = File.join(@destination, relpath) content = @alterant.transform(item) write_status = @write_manager.status(abspath, content) case write_status when :different @writer.write(abspath, content) when :identical, :double_write_error # we'll defer all other cases to the reporter end @reporter.call(item, write_status) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
munge-0.10.0 | lib/munge/runner.rb |
munge-0.9.0 | lib/munge/runner.rb |
munge-0.8.0 | lib/munge/runner.rb |
munge-0.7.1 | lib/munge/runner.rb |