Sha256: f537f1712febd30970b66008107a6a47e0c78a1e9e01e66d274661ce9a4e87ee
Contents?: true
Size: 411 Bytes
Versions: 1
Compression:
Stored size: 411 Bytes
Contents
# frozen_string_literal: true module Pull class Take def initialize(limit) @limit = limit @index = 0 end def call(read) -> (finish, callback) { if finish on_abort.() return nil end read.(nil, -> (value) { return nil if @index >= @limit callback.(value) @index += 1 }) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pull_stream-1.0.0 | lib/pull/through/take.rb |