Sha256: 53224b0f162dd02355f85d5530f755d12277680969f57d0bcc2863057b7f4187

Contents?: true

Size: 608 Bytes

Versions: 17

Compression:

Stored size: 608 Bytes

Contents

module DeadlySerious
  module Processes
    class Splitter
      def initialize
        Signal.trap('USR1') { @outputs = @writers.dup }
      end
      def run(readers: [], writers: [])
        @writers ||= writers
        reader = readers.first
        @outputs = @writers.dup
        begin
          reader.each do |line|
            @current = @outputs.first
            @current << line
            @outputs.rotate!
          end
        rescue => e
          puts e.inspect
          @outputs.delete(@current)
          raise e if @outputs.empty?
          retry
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
deadly_serious-2.0.0.pre.rc3 lib/deadly_serious/processes/splitter.rb
deadly_serious-2.0.0.pre.rc2 lib/deadly_serious/processes/splitter.rb
deadly_serious-2.0.0.pre.rc1 lib/deadly_serious/processes/splitter.rb
deadly_serious-1.0.2 lib/deadly_serious/processes/splitter.rb
deadly_serious-1.0.1 lib/deadly_serious/processes/splitter.rb
deadly_serious-1.0.0 lib/deadly_serious/processes/splitter.rb
deadly_serious-1.0.0.rc1 lib/deadly_serious/processes/splitter.rb
deadly_serious-1.0.0.pre lib/deadly_serious/processes/splitter.rb
deadly_serious-0.12.0 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.11.0 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.10.0 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.9.5 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.9.4 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.9.3 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.9.2 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.9.1 lib/deadly_serious/processes/splitter.rb
deadly_serious-0.9.0 lib/deadly_serious/processes/splitter.rb