Sha256: 470f2238483ee1e601a39301932e9049100b0d1c370205d36fb60be65ac604d2

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

module Itiel
  module Script
    #
    # Process the stream with ruby
    #
    # Initialize it with a block that will yield each row of the stream.
    #
    # Usage:
    #
    #   Itiel::Script::RubyScript.new do |row|
    #     row["slug"] = row["title"]
    #   end
    #
    class RubyScript
      include ChainedStep

      attr_accessor :block

      def initialize(&block)
        self.block = block
      end

      def execute(input_stream)
        input_stream.each do |row|
          block.call(row)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itiel-0.1.2 lib/itiel/script/ruby_script.rb
itiel-0.1.1 lib/itiel/script/ruby_script.rb
itiel-0.1.0 lib/itiel/script/ruby_script.rb