pipe-ruby 1.0.0 → 1.0.2
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 +5 -5
- data/lib/pipe/version.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- metadata +30 -25
- data/.gitignore +0 -14
- data/.rspec +0 -1
- data/CHANGELOG.md +0 -4
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -152
- data/Rakefile +0 -2
- data/pipe-ruby.gemspec +0 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fbadf311c963de6b2d2b3afb84a0f2b77289a87a8845113bf50f151ed75f5f2e
|
|
4
|
+
data.tar.gz: 4ce615623a052ebfbdb74e09ada70331e51d2030af9e0103ea32f01f1545b6d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01ee3e1028218949442ac2ee4367e20664fa338f286214963a61ecfa957339530f029d67fba56f319358c6b31fecc13d2047884f7a7409425ded43871286d904
|
|
7
|
+
data.tar.gz: 1f5ff71f0f374c2366f97c5acdb8265afb5652fd9819e3d407d7e49a03c0d1f4551fe91d2bc307e2d5ce7a72c9aa573ff1a9b92d5dd77fa8b17599d426e0c90c
|
data/lib/pipe/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pipe-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Matthews, Paul Hanyzewski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-09-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '0'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 12.3.3
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 12.3.3
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '3.
|
|
47
|
+
version: '3.9'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '3.
|
|
54
|
+
version: '3.9'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: pry
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,6 +66,20 @@ dependencies:
|
|
|
66
66
|
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: simplecov
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
69
83
|
description: ''
|
|
70
84
|
email:
|
|
71
85
|
- devs@teamsnap.com
|
|
@@ -73,13 +87,6 @@ executables: []
|
|
|
73
87
|
extensions: []
|
|
74
88
|
extra_rdoc_files: []
|
|
75
89
|
files:
|
|
76
|
-
- ".gitignore"
|
|
77
|
-
- ".rspec"
|
|
78
|
-
- CHANGELOG.md
|
|
79
|
-
- Gemfile
|
|
80
|
-
- LICENSE.txt
|
|
81
|
-
- README.md
|
|
82
|
-
- Rakefile
|
|
83
90
|
- lib/pipe.rb
|
|
84
91
|
- lib/pipe/config.rb
|
|
85
92
|
- lib/pipe/ext/inflection.rb
|
|
@@ -87,12 +94,11 @@ files:
|
|
|
87
94
|
- lib/pipe/iterator.rb
|
|
88
95
|
- lib/pipe/reducer.rb
|
|
89
96
|
- lib/pipe/version.rb
|
|
90
|
-
- pipe-ruby.gemspec
|
|
91
97
|
- spec/pipe/config_spec.rb
|
|
92
98
|
- spec/pipe/iterator_spec.rb
|
|
93
99
|
- spec/pipe/reducer_spec.rb
|
|
94
100
|
- spec/spec_helper.rb
|
|
95
|
-
homepage:
|
|
101
|
+
homepage: https://github.com/teamsnap/pipe-ruby
|
|
96
102
|
licenses:
|
|
97
103
|
- MIT
|
|
98
104
|
metadata: {}
|
|
@@ -102,17 +108,16 @@ require_paths:
|
|
|
102
108
|
- lib
|
|
103
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
110
|
requirements:
|
|
105
|
-
- - "
|
|
111
|
+
- - ">="
|
|
106
112
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: '2.
|
|
113
|
+
version: '2.3'
|
|
108
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
115
|
requirements:
|
|
110
116
|
- - ">="
|
|
111
117
|
- !ruby/object:Gem::Version
|
|
112
118
|
version: '0'
|
|
113
119
|
requirements: []
|
|
114
|
-
|
|
115
|
-
rubygems_version: 2.5.2.3
|
|
120
|
+
rubygems_version: 3.2.22
|
|
116
121
|
signing_key:
|
|
117
122
|
specification_version: 4
|
|
118
123
|
summary: Ruby implementation of the UNIX pipe
|
data/.gitignore
DELETED
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--color
|
data/CHANGELOG.md
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2015 TeamSnap
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# Pipe
|
|
2
|
-
|
|
3
|
-
`pipe-ruby` is an implementation of the UNIX pipe command. It exposes two
|
|
4
|
-
instance methods, `pipe` and `pipe_each`.
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
Add this line to your application's Gemfile:
|
|
9
|
-
|
|
10
|
-
```ruby
|
|
11
|
-
gem "pipe-ruby", :require => "pipe"
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
After bundling, include the `Pipe` module in your class(es)
|
|
15
|
-
|
|
16
|
-
```ruby
|
|
17
|
-
class MyClass
|
|
18
|
-
include Pipe
|
|
19
|
-
|
|
20
|
-
# ...
|
|
21
|
-
end
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Default Usage
|
|
25
|
-
|
|
26
|
-
### #pipe
|
|
27
|
-
|
|
28
|
-
```ruby
|
|
29
|
-
pipe(subject, :through => [
|
|
30
|
-
:method1, :method2#, ...
|
|
31
|
-
])
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Just as with the UNIX pipe, `subject` will be passed as the first argument to
|
|
35
|
-
`method1`. The results of `method1` will be passed to `method2` and on and
|
|
36
|
-
on. The result of the last method called will be returned from the pipe.
|
|
37
|
-
|
|
38
|
-
### #pipe_each
|
|
39
|
-
|
|
40
|
-
```ruby
|
|
41
|
-
pipe_each([subj1, subj2], :through => [
|
|
42
|
-
:method1, :method2#, ...
|
|
43
|
-
])
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
`pipe_each` calls `pipe`, passing each individual subject. It will return a
|
|
47
|
-
mapped array of the responses.
|
|
48
|
-
|
|
49
|
-
## Configurable Options
|
|
50
|
-
|
|
51
|
-
After implementing the `pipe` method in a few different places, we found that a
|
|
52
|
-
slightly different version was needed for each use case. `Pipe::Config` allows
|
|
53
|
-
for this customization per call or per class implementation. There are four
|
|
54
|
-
configurable options. Here they are with their defaults:
|
|
55
|
-
|
|
56
|
-
```ruby
|
|
57
|
-
Pipe::Config.new(
|
|
58
|
-
:skip_on => false, # a truthy value or proc which tells pipe to skip
|
|
59
|
-
# the next method in the `through` array
|
|
60
|
-
|
|
61
|
-
:stop_on => false # a truthy value or proc which tells pipe to stop
|
|
62
|
-
# processing and return the current value
|
|
63
|
-
)
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
A `Pipe::Config` object can be passed to the pipe method one of three ways.
|
|
67
|
-
|
|
68
|
-
NOTE: The options below are in priority order, meaning an override of the
|
|
69
|
-
`pipe_config` method will take precedence over an override of the `@pipe_config`
|
|
70
|
-
instance variable.
|
|
71
|
-
|
|
72
|
-
You can pass it to pipe when called:
|
|
73
|
-
|
|
74
|
-
```ruby
|
|
75
|
-
class MyClass
|
|
76
|
-
include Pipe
|
|
77
|
-
|
|
78
|
-
def my_method
|
|
79
|
-
config = Pipe::Config.new(:skip_on => false)
|
|
80
|
-
subject = Object.new
|
|
81
|
-
|
|
82
|
-
pipe(subject, :config => config, :through => [
|
|
83
|
-
# ...
|
|
84
|
-
])
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
# ...
|
|
88
|
-
end
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Or override the `pipe_config` method:
|
|
92
|
-
|
|
93
|
-
```ruby
|
|
94
|
-
class MyClass
|
|
95
|
-
include Pipe
|
|
96
|
-
|
|
97
|
-
def pipe_config
|
|
98
|
-
Pipe::Config.new(:skip_on => false)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# ...
|
|
102
|
-
end
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Or you can assign it to the `@pipe_config` instance variable:
|
|
106
|
-
|
|
107
|
-
```ruby
|
|
108
|
-
class MyClass
|
|
109
|
-
include Pipe
|
|
110
|
-
|
|
111
|
-
def initialize
|
|
112
|
-
@pipe_config = Pipe::Config.new(:skip_on => false)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# ...
|
|
116
|
-
end
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Skipping / Stopping Execution
|
|
120
|
-
|
|
121
|
-
At the beginning of each iteration, `Pipe::Config#stop_on` is called. If it
|
|
122
|
-
returns truthy, execution will be stopped and the current value of subject will
|
|
123
|
-
be returned. A falsey response will allow the execution to move forward.
|
|
124
|
-
|
|
125
|
-
If not stopped, `Pipe::Config#skip_on` will be called. Truthy responses will
|
|
126
|
-
cause the current value of subject to be passed to the next iteration without
|
|
127
|
-
calling the method specified in the current iteration. Falsey responses will
|
|
128
|
-
allow the specified method to be called.
|
|
129
|
-
|
|
130
|
-
Both skip_on and stop_on will receive three arguments when they're called, the
|
|
131
|
-
current value of subject, the method to be called on this iteration and the
|
|
132
|
-
value of `#through`.
|
|
133
|
-
|
|
134
|
-
## Contributing
|
|
135
|
-
|
|
136
|
-
First: please check out our [style guides](https://github.com/teamsnap/guides/tree/master/ruby)...
|
|
137
|
-
we will hold you to them :)
|
|
138
|
-
|
|
139
|
-
1. Fork it ( https://github.com/[my-github-username]/pipe-ruby/fork )
|
|
140
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
141
|
-
3. Make sure you're green (`bundle exec rspec`)
|
|
142
|
-
4. Commit your changes (`git commit -am 'Add some feature'`)
|
|
143
|
-
5. Push to the branch (`git push origin my-new-feature`)
|
|
144
|
-
6. Create a new Pull Request
|
|
145
|
-
|
|
146
|
-
## Testing
|
|
147
|
-
|
|
148
|
-
`bundle exec rspec`
|
|
149
|
-
|
|
150
|
-
We like to have good coverage of each major feature. Before contributing with a
|
|
151
|
-
PR, please make sure you've added tests and are fully green.
|
|
152
|
-
|
data/Rakefile
DELETED
data/pipe-ruby.gemspec
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'pipe/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "pipe-ruby"
|
|
8
|
-
spec.version = Pipe::VERSION
|
|
9
|
-
spec.authors = ["Dan Matthews, Paul Hanyzewski"]
|
|
10
|
-
spec.email = ["devs@teamsnap.com"]
|
|
11
|
-
spec.summary = %q{Ruby implementation of the UNIX pipe}
|
|
12
|
-
spec.description = %q{}
|
|
13
|
-
spec.homepage = ""
|
|
14
|
-
spec.license = "MIT"
|
|
15
|
-
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
-
spec.require_paths = ["lib"]
|
|
20
|
-
spec.required_ruby_version = "~> 2.1"
|
|
21
|
-
|
|
22
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
|
23
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.1"
|
|
25
|
-
spec.add_development_dependency "pry"
|
|
26
|
-
end
|