Sha256: 50f020f68cc7ff5c25b9f65cf67c7a4591f44710af6f33b2a49b2c373e7d7fd4

Contents?: true

Size: 1004 Bytes

Versions: 3

Compression:

Stored size: 1004 Bytes

Contents

module Itiel
  module Load
    #
    # This module defines the input and output behavior for Loader steps
    #
    # Whenever the instance receives input, it calls persist! and then
    # wires the input and the output
    #
    # All the clasess in Itiel::Output should implement persist!
    #
    module ChainedStep
      module InstanceMethods
        attr_accessor :next_step

        alias :>> :next_step=

        def input=(input_stream)
          Itiel::Logger.log_received(self, input_stream.size)
          persist(input_stream)
          self.next_step.input = input_stream if next_step
          Itiel::Logger.log_processed(self, input_stream.size)
        end

        #
        # This method must be implemented in the class
        #
        def persist(input_stream)
          raise Itiel::MethodNotImplementedException.new "persist is not implemented"
        end
      end

      def self.included(receiver)
        receiver.send :include, InstanceMethods
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itiel-0.1.2 lib/itiel/load/chained_step.rb
itiel-0.1.1 lib/itiel/load/chained_step.rb
itiel-0.1.0 lib/itiel/load/chained_step.rb