class Frappuccino::Take
Public Class Methods
new(source, n)
click to toggle source
# File lib/frappuccino/stream/take.rb, line 3 def initialize(source, n) @n = n @length = 0 source.add_observer(self) end
Public Instance Methods
update(value)
click to toggle source
# File lib/frappuccino/stream/take.rb, line 9 def update(value) if @length < @n occur(value) @length += 1 end end