piperator 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codecov.yaml +7 -0
- data/.github/workflows/ci.yml +41 -0
- data/Gemfile +5 -0
- data/README.md +1 -3
- data/lib/piperator/io.rb +4 -3
- data/lib/piperator/pipeline.rb +1 -5
- data/lib/piperator/version.rb +1 -1
- metadata +8 -7
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9269910cd3b64e1184e36d5569a356820a72faac26c3a06dc8fc2e5e5542c6ae
|
4
|
+
data.tar.gz: 5a38bc706afb02a408ff6e45a5dd991a05185b8e2c93025cab42f720bda636cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06e1e83db7fd2e8bdb6fa699168f034a97ae83fecb07f694b027f9c87c504bf934e83d08384f9201b0d5111be6d2a4bb1ca4a9567fc49e2359d5b1bc5cb4db01
|
7
|
+
data.tar.gz: 7896a21f84da09fc97b66ccb35f384fe872e1ffcca98033c388154a809560c34ac83f9ae97d8accb67fa1ebcb9d119c8c8d8550b00be2d77caf1809fb8cac6db
|
data/.codecov.yaml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: >-
|
8
|
+
Test (${{ matrix.os }} ${{ matrix.ruby }})
|
9
|
+
runs-on: ${{ matrix.os }}-latest
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
os: [ubuntu, macos, windows]
|
14
|
+
ruby:
|
15
|
+
- 2.3
|
16
|
+
- 2.4
|
17
|
+
- 2.5
|
18
|
+
- 2.6
|
19
|
+
- 2.7
|
20
|
+
- "3.0"
|
21
|
+
- "3.1"
|
22
|
+
- "3.2"
|
23
|
+
- jruby
|
24
|
+
- truffleruby
|
25
|
+
exclude:
|
26
|
+
- os: windows
|
27
|
+
ruby: jruby
|
28
|
+
- os: windows
|
29
|
+
ruby: truffleruby
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
bundler-cache: true
|
36
|
+
- run: bundle exec rake
|
37
|
+
- uses: codecov/codecov-action@v2
|
38
|
+
if: ${{ matrix.os == 'ubuntu' && matrix.ruby == '3.0' }}
|
39
|
+
with:
|
40
|
+
file: ./coverage/coverage.xml
|
41
|
+
fail_ci_if_error: true
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
Pipelines for streaming large collections. The pipeline enables composition of streaming pipelines with lazy enumerables.
|
4
4
|
|
5
|
-
The library is heavily inspired by [Elixir pipe operator](https://elixirschool.com/lessons/basics/pipe-operator/) and [Node.js Stream](https://nodejs.org/api/stream.html).
|
6
|
-
|
7
|
-
[](https://travis-ci.org/lautis/piperator)
|
5
|
+
The library is heavily inspired by [Elixir pipe operator](https://elixirschool.com/en/lessons/basics/pipe-operator/) and [Node.js Stream](https://nodejs.org/api/stream.html).
|
8
6
|
|
9
7
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
10
8
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
data/lib/piperator/io.rb
CHANGED
@@ -62,14 +62,15 @@ module Piperator
|
|
62
62
|
# Reads length bytes from the I/O stream.
|
63
63
|
#
|
64
64
|
# @param length [Integer] number of bytes to read
|
65
|
+
# @param buffer [String] optional read buffer
|
65
66
|
# @return String
|
66
|
-
def read(length = nil)
|
67
|
+
def read(length = nil, buffer = nil)
|
67
68
|
return @enumerator.next.tap { |e| @pos += e.bytesize } if length.nil? && readable_bytes.zero?
|
68
69
|
@buffer.write(@enumerator.next) while !@eof && readable_bytes < (length || 1)
|
69
|
-
read_with { @buffer.read(length) }
|
70
|
+
read_with { @buffer.read(length, buffer) }
|
70
71
|
rescue StopIteration
|
71
72
|
@eof = true
|
72
|
-
read_with { @buffer.read(length) } if readable_bytes > 0
|
73
|
+
read_with { @buffer.read(length, buffer) } if readable_bytes > 0
|
73
74
|
end
|
74
75
|
|
75
76
|
# Current buffer size - including non-freed read content
|
data/lib/piperator/pipeline.rb
CHANGED
@@ -13,11 +13,7 @@ module Piperator
|
|
13
13
|
# @return [Pipeline] A pipeline containing only the lazily evaluated
|
14
14
|
# callable.
|
15
15
|
def self.lazy(&block)
|
16
|
-
|
17
|
-
Pipeline.new([lambda do |e|
|
18
|
-
callable ||= block.call
|
19
|
-
callable.call(e)
|
20
|
-
end])
|
16
|
+
Pipeline.new([]).lazy(&block)
|
21
17
|
end
|
22
18
|
|
23
19
|
# Build a new pipeline from a callable or an enumerable object
|
data/lib/piperator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piperator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ville Lautanala
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,9 +60,10 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- ".codecov.yaml"
|
64
|
+
- ".github/workflows/ci.yml"
|
63
65
|
- ".gitignore"
|
64
66
|
- ".rspec"
|
65
|
-
- ".travis.yml"
|
66
67
|
- CHANGELOG.md
|
67
68
|
- Gemfile
|
68
69
|
- LICENSE.txt
|
@@ -80,7 +81,7 @@ homepage: https://github.com/lautis/piperator
|
|
80
81
|
licenses:
|
81
82
|
- MIT
|
82
83
|
metadata: {}
|
83
|
-
post_install_message:
|
84
|
+
post_install_message:
|
84
85
|
rdoc_options: []
|
85
86
|
require_paths:
|
86
87
|
- lib
|
@@ -95,8 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: '0'
|
97
98
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
99
|
-
signing_key:
|
99
|
+
rubygems_version: 3.2.22
|
100
|
+
signing_key:
|
100
101
|
specification_version: 4
|
101
102
|
summary: Composable pipelines for streaming large collections
|
102
103
|
test_files: []
|