Class: DStream::Zip

Inherits:
Abstract show all
Defined in:
lib/d-stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(other) ⇒ Zip

Returns a new instance of Zip.



172
173
174
# File 'lib/d-stream.rb', line 172

def initialize(other)
  @other = other
end

Instance Method Details

#apply(s) ⇒ Object



180
181
182
183
184
185
186
# File 'lib/d-stream.rb', line 180

def apply(s)
  Enumerator.new do |y|
    s.lazy.zip(@other).each do |e, i|
      y << [e, i]
    end
  end.lazy
end

#inspectObject



176
177
178
# File 'lib/d-stream.rb', line 176

def inspect
  "<DStream::Zip #{@other.inspect}>"
end