Sha256: 569a8188daf9fb1e51cd44fbd56cbb9d6507769b559a566b590cac580eb916df

Contents?: true

Size: 932 Bytes

Versions: 6

Compression:

Stored size: 932 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

6 entries across 6 versions & 1 rubygems

Version Path
awestruct-0.2.18 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.17 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.15 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.14 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.13 lib/awestruct/extensions/pipeline.rb
awestruct-0.2.12 lib/awestruct/extensions/pipeline.rb