Sha256: cf056137402e29a8ac02a02f2fd7f03bc1f5abed08fdb56c68834d2d41db04d5

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

module Munge
  class Application
    def initialize(system)
      @system = system
    end

    def source
      @system.source
    end

    def write(&block)
      @system.source
        .reject { |item| item.route.nil? }
        .each   { |item| render_and_write(item, &block) }
    end

    def build_virtual_item(*args)
      @system.source.build(*args)
    end

    def create(*args)
      item = build_virtual_item(*args)
      yield item if block_given?
      @system.source.push(item)
    end

    private

    def render_and_write(item, &block)
      relpath = @system.router.filepath(item)

      write_status = @system.writer.write(relpath, @system.alterant.transform(item))

      if block_given?
        block.call(item, write_status)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
munge-0.5.0.beta1 lib/munge/application.rb