Sha256: c17eb834e71d676b84d764550c553d53a269144ae14824e15d4adcb63be4b10c

Contents?: true

Size: 933 Bytes

Versions: 8

Compression:

Stored size: 933 Bytes

Contents

module Awestruct
  module Extensions

    class Pipeline

      attr_reader :before_extensions
      attr_reader :extensions
      attr_reader :after_extensions
      attr_reader :helpers
      attr_reader :transformers

      def initialize(&block)
        @extensions = []
        @helpers    = []
        @transformers  = []
        instance_eval &block if block
      end

      def extension(ext)
        @extensions << ext
        ext.transform(@transformers) if ext.respond_to?('transform')
      end

      def helper(helper)
        @helpers << helper
      end

      def transformer(transformer)
        @transformers << transformer
      end

      def execute(site)
        extensions.each do |ext|
          ext.execute( site )
        end
      end

      def watch(watched_dirs)
        extensions.each do |ext|
          ext.watch( watched_dirs ) if ext.respond_to?('watch')
        end
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
awestruct-0.2.11 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.10 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.9 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.8 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.7 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.6 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.5 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.4 lib/awestruct/extensions/pipeline.rb