Sha256: d283280a0e0fc3ab4d6b5ffda4c8e13ba75fd80e92c215918b62bb4ca573f775

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

module Pacer::Pipes
  class EnumerablePipe < RubyPipe
    def initialize(enumerable)
      super()
      case enumerable
      when Enumerator
        starts = enumerable
      when Pacer::ElementMixin
        starts = [enumerable].to_enum
      when Enumerable
        starts = enumerable.to_enum
      else
        starts = [enumerable].to_enum
      end
      set_starts starts
    end

    def processNextStart()
      @starts.next
    rescue StopIteration
      raise Pacer::NoSuchElementException
    rescue NativeException => e
      if e.cause.getClass == Pacer::NoSuchElementException.getClass
        raise e.cause
      else
        raise e
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pacer-0.9.1.1-java lib/pacer/pipe/enumerable_pipe.rb