piperator 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1475b2b74289ce3c32f638a67156b943101bff0b548283e2e1ea635d5048a6e5
4
- data.tar.gz: 3d06228a633975fde9409387471bb505eb192971c8e50e7ce0df34bbc74e2ae1
3
+ metadata.gz: 9269910cd3b64e1184e36d5569a356820a72faac26c3a06dc8fc2e5e5542c6ae
4
+ data.tar.gz: 5a38bc706afb02a408ff6e45a5dd991a05185b8e2c93025cab42f720bda636cb
5
5
  SHA512:
6
- metadata.gz: 9a11be79d16a0a54c21cb62518ce6426a184c9c9d6609dc6424533413d6cee875f57d74411d92b39dc57fbf9d25d5e712b112149d7bc16d3f42a6f972e52284a
7
- data.tar.gz: e2cec664b6832086b53cdaa200b03852f6dcd62cb4f3c5b18532ea636054b0c599471d84a181857e36919cea400a68f1e6fdd93bdeb03e9f612107acdcd4768f
6
+ metadata.gz: 06e1e83db7fd2e8bdb6fa699168f034a97ae83fecb07f694b027f9c87c504bf934e83d08384f9201b0d5111be6d2a4bb1ca4a9567fc49e2359d5b1bc5cb4db01
7
+ data.tar.gz: 7896a21f84da09fc97b66ccb35f384fe872e1ffcca98033c388154a809560c34ac83f9ae97d8accb67fa1ebcb9d119c8c8d8550b00be2d77caf1809fb8cac6db
data/.codecov.yaml ADDED
@@ -0,0 +1,7 @@
1
+ comment: false
2
+
3
+ coverage:
4
+ status:
5
+ project:
6
+ default:
7
+ only_pulls: true
@@ -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
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in piperator.gemspec
4
4
  gemspec
5
+
6
+ if RUBY_VERSION >= '2.5'
7
+ gem 'simplecov', '~> 0.21.2', group: [:development]
8
+ gem 'simplecov-cobertura', '~> 2.1.0', group: [:development]
9
+ end
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
- [![Build Status](https://travis-ci.org/lautis/piperator.svg?branch=master)](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
@@ -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
- callable = nil
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
@@ -1,4 +1,4 @@
1
1
  module Piperator
2
2
  # Piperator version
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
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.2.0
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: 2020-06-02 00:00:00.000000000 Z
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.1.2
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: []
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- sudo: false
2
- cache: bundler
3
- language: ruby
4
- rvm:
5
- - 2.3
6
- - 2.4
7
- - 2.5
8
- - 2.6
9
- - 2.7
10
- - jruby
11
- - truffleruby