Class: Dataflow::Port::Stream

Inherits:
Object
  • Object
show all
Includes:
Dataflow, Enumerable
Defined in:
lib/vendor/dataflow/dataflow/port.rb

Constant Summary

Constants included from Dataflow

UnificationError, VERSION

Instance Method Summary collapse

Methods included from Enumerable

#to_json

Methods included from Dataflow

#barrier, #by_need, #flow, included, #local, #need_later, #unify

Instance Method Details

#eachObject



17
18
19
20
21
22
23
# File 'lib/vendor/dataflow/dataflow/port.rb', line 17

def each
  s = self
  loop do
    yield s.head
    s = s.tail
  end
end

#take(num) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/vendor/dataflow/dataflow/port.rb', line 27

def take(num)
  result = []
  each_with_index do |x, i|
    return result if num == i
    result << x
  end
end