pipeable 0.0.1 → 0.1.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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.adoc +134 -0
- data/README.adoc +574 -0
- data/lib/pipeable/composable.rb +12 -0
- data/lib/pipeable/pipe.rb +16 -0
- data/lib/pipeable/stepable.rb +51 -0
- data/lib/pipeable/steps/abstract.rb +25 -0
- data/lib/pipeable/steps/as.rb +12 -0
- data/lib/pipeable/steps/bind.rb +10 -0
- data/lib/pipeable/steps/check.rb +30 -0
- data/lib/pipeable/steps/container.rb +26 -0
- data/lib/pipeable/steps/fmap.rb +10 -0
- data/lib/pipeable/steps/insert.rb +27 -0
- data/lib/pipeable/steps/map.rb +10 -0
- data/lib/pipeable/steps/merge.rb +27 -0
- data/lib/pipeable/steps/or.rb +10 -0
- data/lib/pipeable/steps/tee.rb +22 -0
- data/lib/pipeable/steps/to.rb +27 -0
- data/lib/pipeable/steps/try.rb +23 -0
- data/lib/pipeable/steps/use.rb +19 -0
- data/lib/pipeable/steps/validate.rb +28 -0
- data/lib/pipeable.rb +16 -3
- data/pipeable.gemspec +30 -18
- data.tar.gz.sig +0 -0
- metadata +121 -49
- metadata.gz.sig +0 -0
- data/.gitignore +0 -17
- data/.travis.yml +0 -1
- data/Gemfile +0 -5
- data/LICENSE.txt +0 -22
- data/README.md +0 -46
- data/Rakefile +0 -1
- data/lib/pipeable/version.rb +0 -3
- data/spec/pipeable_spec.rb +0 -27
- data/spec/spec_helper.rb +0 -11
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Checks if operation is true and then answers success (passthrough) or failure (with argument).
|
6
|
+
class Check < Abstract
|
7
|
+
def initialize(operation, message, **)
|
8
|
+
super(**)
|
9
|
+
@operation = operation
|
10
|
+
@message = message
|
11
|
+
end
|
12
|
+
|
13
|
+
def call result
|
14
|
+
result.bind do |arguments|
|
15
|
+
answer = question arguments
|
16
|
+
answer == true || answer.is_a?(Success) ? result : Failure(arguments)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :operation, :message
|
23
|
+
|
24
|
+
def question arguments
|
25
|
+
splat = marameters.categorize operation.method(message).parameters, arguments
|
26
|
+
operation.public_send(message, *splat.positionals, **splat.keywords, &splat.block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/container"
|
4
|
+
|
5
|
+
module Pipeable
|
6
|
+
module Steps
|
7
|
+
# Registers default steps.
|
8
|
+
module Container
|
9
|
+
extend Dry::Container::Mixin
|
10
|
+
|
11
|
+
register(:as) { As }
|
12
|
+
register(:bind) { Bind }
|
13
|
+
register(:check) { Check }
|
14
|
+
register(:fmap) { Fmap }
|
15
|
+
register(:insert) { Insert }
|
16
|
+
register(:map) { Map }
|
17
|
+
register(:merge) { Merge }
|
18
|
+
register(:orr) { Or }
|
19
|
+
register(:tee) { Tee }
|
20
|
+
register(:to) { To }
|
21
|
+
register(:try) { Try }
|
22
|
+
register(:use) { Use }
|
23
|
+
register(:validate) { Validate }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Inserts elements before, after, or around input.
|
6
|
+
class Insert < Abstract
|
7
|
+
LAST = -1
|
8
|
+
|
9
|
+
def initialize(*positionals, at: LAST, **)
|
10
|
+
super(*positionals, **)
|
11
|
+
@value = positionals.empty? ? base_keywords : positionals.flatten
|
12
|
+
@at = at
|
13
|
+
end
|
14
|
+
|
15
|
+
def call result
|
16
|
+
result.fmap do |input|
|
17
|
+
cast = input.is_a?(Array) ? input : [input]
|
18
|
+
value.is_a?(Array) ? cast.insert(at, *value) : cast.insert(at, value)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :value, :at
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Maps over a collection, processing each element, and answering a new result.
|
6
|
+
class Map < Abstract
|
7
|
+
def call(result) = result.fmap { |collection| collection.map(&base_block) }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Merges initialized attributes with step argument for use by a subsequent step.
|
6
|
+
class Merge < Abstract
|
7
|
+
def initialize as: :step, **keywords
|
8
|
+
super(**keywords)
|
9
|
+
@as = as
|
10
|
+
end
|
11
|
+
|
12
|
+
def call result
|
13
|
+
result.fmap do |input|
|
14
|
+
if input.is_a? Hash
|
15
|
+
input.merge! base_keywords
|
16
|
+
else
|
17
|
+
{as => input}.merge!(base_keywords)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :as
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Messages operation, without any response checks, while passing input through as output.
|
6
|
+
class Tee < Abstract
|
7
|
+
def initialize(operation, *, **)
|
8
|
+
super(*, **)
|
9
|
+
@operation = operation
|
10
|
+
end
|
11
|
+
|
12
|
+
def call result
|
13
|
+
operation.public_send(*base_positionals, **base_keywords)
|
14
|
+
result
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
attr_reader :operation
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Delegates to a non-callable operation which automatically wraps the result if necessary.
|
6
|
+
class To < Abstract
|
7
|
+
def initialize(operation, message, **)
|
8
|
+
super(**)
|
9
|
+
@operation = operation
|
10
|
+
@message = message
|
11
|
+
end
|
12
|
+
|
13
|
+
def call result
|
14
|
+
result.bind do |arguments|
|
15
|
+
splat = marameters.categorize operation.method(message).parameters, arguments
|
16
|
+
wrap operation.public_send(message, *splat.positionals, **splat.keywords, &splat.block)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :operation, :message
|
23
|
+
|
24
|
+
def wrap(result) = result.is_a?(Dry::Monads::Result) ? result : Success(result)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Messages a risky operation which may pass or fail.
|
6
|
+
class Try < Abstract
|
7
|
+
def initialize *positionals, catch:, **keywords
|
8
|
+
super(*positionals, **keywords)
|
9
|
+
@catch = catch
|
10
|
+
end
|
11
|
+
|
12
|
+
def call result
|
13
|
+
result.fmap { |operation| operation.public_send(*base_positionals, **base_keywords) }
|
14
|
+
rescue *Array(catch) => error
|
15
|
+
Failure error.message
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :catch
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Use another transaction -- or any command -- which answers a result.
|
6
|
+
class Use < Abstract
|
7
|
+
def initialize(operation, **)
|
8
|
+
super(**)
|
9
|
+
@operation = operation
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(result) = result.bind { |input| operation.call input }
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
attr_reader :operation
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipeable
|
4
|
+
module Steps
|
5
|
+
# Validates a result via a callable operation.
|
6
|
+
class Validate < Abstract
|
7
|
+
def initialize(operation, as: :to_h, **)
|
8
|
+
super(**)
|
9
|
+
@operation = operation
|
10
|
+
@as = as
|
11
|
+
end
|
12
|
+
|
13
|
+
def call result
|
14
|
+
result.bind do |payload|
|
15
|
+
value = operation.call payload
|
16
|
+
|
17
|
+
return Failure value if value.failure?
|
18
|
+
|
19
|
+
Success(as ? value.public_send(as) : value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :operation, :as
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/pipeable.rb
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "zeitwerk"
|
4
|
+
|
5
|
+
Zeitwerk::Loader.new.then do |loader|
|
6
|
+
loader.tag = File.basename __FILE__, ".rb"
|
7
|
+
loader.push_dir __dir__
|
8
|
+
loader.setup
|
9
|
+
end
|
10
|
+
|
11
|
+
# Main namespace.
|
3
12
|
module Pipeable
|
4
|
-
def
|
5
|
-
|
13
|
+
def self.included(descendant) = descendant.include Stepable.new
|
14
|
+
|
15
|
+
def self.loader registry = Zeitwerk::Registry
|
16
|
+
@loader ||= registry.loaders.find { |loader| loader.tag == File.basename(__FILE__, ".rb") }
|
6
17
|
end
|
18
|
+
|
19
|
+
def self.with(...) = Stepable.new(...)
|
7
20
|
end
|
data/pipeable.gemspec
CHANGED
@@ -1,22 +1,34 @@
|
|
1
|
-
#
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'pipeable/version'
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.license
|
14
|
-
spec.files = `git ls-files -z`.split("\x0")
|
15
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
-
spec.require_paths = ["lib"]
|
4
|
+
spec.name = "pipeable"
|
5
|
+
spec.version = "0.1.0"
|
6
|
+
spec.authors = ["Brooke Kuhlmann"]
|
7
|
+
spec.email = ["brooke@alchemists.io"]
|
8
|
+
spec.homepage = "https://alchemists.io/projects/pipeable"
|
9
|
+
spec.summary = "An implementation of the Railway Pattern for functional composable pipelines."
|
10
|
+
spec.license = "Hippocratic-2.1"
|
18
11
|
|
19
|
-
spec.
|
20
|
-
|
21
|
-
|
12
|
+
spec.metadata = {
|
13
|
+
"bug_tracker_uri" => "https://github.com/bkuhlmann/pipeable/issues",
|
14
|
+
"changelog_uri" => "https://alchemists.io/projects/pipeable/versions",
|
15
|
+
"documentation_uri" => "https://alchemists.io/projects/pipeable",
|
16
|
+
"funding_uri" => "https://github.com/sponsors/bkuhlmann",
|
17
|
+
"label" => "Pipeable",
|
18
|
+
"rubygems_mfa_required" => "true",
|
19
|
+
"source_code_uri" => "https://github.com/bkuhlmann/pipeable"
|
20
|
+
}
|
21
|
+
|
22
|
+
spec.signing_key = Gem.default_key_path
|
23
|
+
spec.cert_chain = [Gem.default_cert_path]
|
24
|
+
|
25
|
+
spec.required_ruby_version = "~> 3.3"
|
26
|
+
spec.add_dependency "dry-container", "~> 0.11"
|
27
|
+
spec.add_dependency "dry-monads", "~> 1.6"
|
28
|
+
spec.add_dependency "marameters", "~> 3.2"
|
29
|
+
spec.add_dependency "refinements", "~> 12.1"
|
30
|
+
spec.add_dependency "zeitwerk", "~> 2.6"
|
31
|
+
|
32
|
+
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
33
|
+
spec.files = Dir["*.gemspec", "lib/**/*"]
|
22
34
|
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,99 +1,171 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipeable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Brooke Kuhlmann
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZicm9v
|
14
|
+
a2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQBGRYC
|
15
|
+
aW8wHhcNMjMwMzIyMTYxNDQxWhcNMjUwMzIxMTYxNDQxWjBBMQ8wDQYDVQQDDAZi
|
16
|
+
cm9va2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQB
|
17
|
+
GRYCaW8wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCro8tj5/E1Hg88
|
18
|
+
f4qfiwPVd2zJQHvdYt4GHVvuHRRgx4HGhJuNp+4BId08RBn7V6V1MW6MY3kezRBs
|
19
|
+
M+7QOQ4b1xNLTvY7FYQB1wGK5a4x7TTokDrPYQxDB2jmsdDYCzVbIMrAvUfcecRi
|
20
|
+
khyGZCdByiiCl4fKv77P12tTT+NfsvXkLt/AYCGwjOUyGKTQ01Z6eC09T27GayPH
|
21
|
+
QQvIkakyFgcJtzSyGzs8bzK5q9u7wQ12MNTjJoXzW69lqp0oNvDylu81EiSUb5S6
|
22
|
+
QzzPxZBiRB1sgtbt1gUbVI262ZDq1gR+HxPFmp+Cgt7ZLIJZAtesQvtcMzseXpfn
|
23
|
+
hpmm0Sw22KGhRAy/mqHBRhDl5HqS1SJp2Ko3lcnpXeFResp0HNlt8NSu13vhC08j
|
24
|
+
GUHU9MyIXbFOsnp3K3ADrAVjPWop8EZkmUR3MV/CUm00w2cZHCSGiXl1KMpiVKvk
|
25
|
+
Ywr1gd2ZME4QLSo+EXUtLxDUa/W3xnBS8dBOuMMz02FPWYr3PN8CAwEAAaN7MHkw
|
26
|
+
CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFAFgmv0tYMZnItuPycSM
|
27
|
+
F5wykJEVMB8GA1UdEQQYMBaBFGJyb29rZUBhbGNoZW1pc3RzLmlvMB8GA1UdEgQY
|
28
|
+
MBaBFGJyb29rZUBhbGNoZW1pc3RzLmlvMA0GCSqGSIb3DQEBCwUAA4IBgQAX+EGY
|
29
|
+
9RLYGxF1VLZz+G1ACQc4uyrCB6kXwI06kzUa5dF9tPXqTX9ffnz3/W8ck2IQhKzu
|
30
|
+
MKO2FVijzbDWTsZeZGglS4E+4Jxpau1lU9HhOIcKolv6LeC6UdALTFudY+GLb8Xw
|
31
|
+
REXgaJkjzzhkUSILmEnRwEbY08dVSl7ZAaxVI679vfI2yapLlIwpbBgmQTiTvPr3
|
32
|
+
qyyLUno9flYEOv9fmGHunSrM+gE0/0niGTXa5GgXBXYGS2he4LQGgSBfGp/cTwMU
|
33
|
+
rDKJRcusZ12lNBeDfgqACz/BBJF8FLodgk6rGMRZz7+ZmjjHEmpG5bQpR6Q2BuWL
|
34
|
+
XMtYk/QzaWuhiR7pWjiF8jbdd7RO6or0ohq7iFkokz/5xrtQ/vPzU2RQ3Qc6YaKw
|
35
|
+
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
|
+
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2024-03-03 00:00:00.000000000 Z
|
12
39
|
dependencies:
|
13
40
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
41
|
+
name: dry-container
|
15
42
|
requirement: !ruby/object:Gem::Requirement
|
16
43
|
requirements:
|
17
|
-
- - ~>
|
44
|
+
- - "~>"
|
18
45
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
46
|
+
version: '0.11'
|
47
|
+
type: :runtime
|
21
48
|
prerelease: false
|
22
49
|
version_requirements: !ruby/object:Gem::Requirement
|
23
50
|
requirements:
|
24
|
-
- - ~>
|
51
|
+
- - "~>"
|
25
52
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
53
|
+
version: '0.11'
|
27
54
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
55
|
+
name: dry-monads
|
29
56
|
requirement: !ruby/object:Gem::Requirement
|
30
57
|
requirements:
|
31
|
-
- -
|
58
|
+
- - "~>"
|
32
59
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
type: :
|
60
|
+
version: '1.6'
|
61
|
+
type: :runtime
|
35
62
|
prerelease: false
|
36
63
|
version_requirements: !ruby/object:Gem::Requirement
|
37
64
|
requirements:
|
38
|
-
- -
|
65
|
+
- - "~>"
|
39
66
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
67
|
+
version: '1.6'
|
41
68
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
69
|
+
name: marameters
|
43
70
|
requirement: !ruby/object:Gem::Requirement
|
44
71
|
requirements:
|
45
|
-
- -
|
72
|
+
- - "~>"
|
46
73
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
74
|
+
version: '3.2'
|
75
|
+
type: :runtime
|
49
76
|
prerelease: false
|
50
77
|
version_requirements: !ruby/object:Gem::Requirement
|
51
78
|
requirements:
|
52
|
-
- -
|
79
|
+
- - "~>"
|
53
80
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
|
81
|
+
version: '3.2'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: refinements
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '12.1'
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '12.1'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: zeitwerk
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2.6'
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '2.6'
|
110
|
+
description:
|
56
111
|
email:
|
57
|
-
-
|
112
|
+
- brooke@alchemists.io
|
58
113
|
executables: []
|
59
114
|
extensions: []
|
60
|
-
extra_rdoc_files:
|
115
|
+
extra_rdoc_files:
|
116
|
+
- README.adoc
|
117
|
+
- LICENSE.adoc
|
61
118
|
files:
|
62
|
-
- .
|
63
|
-
- .
|
64
|
-
- Gemfile
|
65
|
-
- LICENSE.txt
|
66
|
-
- README.md
|
67
|
-
- Rakefile
|
119
|
+
- LICENSE.adoc
|
120
|
+
- README.adoc
|
68
121
|
- lib/pipeable.rb
|
69
|
-
- lib/pipeable/
|
122
|
+
- lib/pipeable/composable.rb
|
123
|
+
- lib/pipeable/pipe.rb
|
124
|
+
- lib/pipeable/stepable.rb
|
125
|
+
- lib/pipeable/steps/abstract.rb
|
126
|
+
- lib/pipeable/steps/as.rb
|
127
|
+
- lib/pipeable/steps/bind.rb
|
128
|
+
- lib/pipeable/steps/check.rb
|
129
|
+
- lib/pipeable/steps/container.rb
|
130
|
+
- lib/pipeable/steps/fmap.rb
|
131
|
+
- lib/pipeable/steps/insert.rb
|
132
|
+
- lib/pipeable/steps/map.rb
|
133
|
+
- lib/pipeable/steps/merge.rb
|
134
|
+
- lib/pipeable/steps/or.rb
|
135
|
+
- lib/pipeable/steps/tee.rb
|
136
|
+
- lib/pipeable/steps/to.rb
|
137
|
+
- lib/pipeable/steps/try.rb
|
138
|
+
- lib/pipeable/steps/use.rb
|
139
|
+
- lib/pipeable/steps/validate.rb
|
70
140
|
- pipeable.gemspec
|
71
|
-
|
72
|
-
- spec/spec_helper.rb
|
73
|
-
homepage: https://www.github.com/baweaver/pipeable
|
141
|
+
homepage: https://alchemists.io/projects/pipeable
|
74
142
|
licenses:
|
75
|
-
-
|
76
|
-
metadata:
|
77
|
-
|
143
|
+
- Hippocratic-2.1
|
144
|
+
metadata:
|
145
|
+
bug_tracker_uri: https://github.com/bkuhlmann/pipeable/issues
|
146
|
+
changelog_uri: https://alchemists.io/projects/pipeable/versions
|
147
|
+
documentation_uri: https://alchemists.io/projects/pipeable
|
148
|
+
funding_uri: https://github.com/sponsors/bkuhlmann
|
149
|
+
label: Pipeable
|
150
|
+
rubygems_mfa_required: 'true'
|
151
|
+
source_code_uri: https://github.com/bkuhlmann/pipeable
|
152
|
+
post_install_message:
|
78
153
|
rdoc_options: []
|
79
154
|
require_paths:
|
80
155
|
- lib
|
81
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
157
|
requirements:
|
83
|
-
- -
|
158
|
+
- - "~>"
|
84
159
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
160
|
+
version: '3.3'
|
86
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
162
|
requirements:
|
88
|
-
- -
|
163
|
+
- - ">="
|
89
164
|
- !ruby/object:Gem::Version
|
90
165
|
version: '0'
|
91
166
|
requirements: []
|
92
|
-
|
93
|
-
|
94
|
-
signing_key:
|
167
|
+
rubygems_version: 3.5.6
|
168
|
+
signing_key:
|
95
169
|
specification_version: 4
|
96
|
-
summary:
|
97
|
-
test_files:
|
98
|
-
- spec/pipeable_spec.rb
|
99
|
-
- spec/spec_helper.rb
|
170
|
+
summary: An implementation of the Railway Pattern for functional composable pipelines.
|
171
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
language: ruby
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Brandon Weaver
|
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,46 +0,0 @@
|
|
1
|
-
# Pipeable
|
2
|
-
|
3
|
-
A play at Unix Piping in Ruby for kicks. It helps to break up some more exotic logic and chaining.
|
4
|
-
|
5
|
-
It can be used to play with a value in a method chain and return whatever you want out of the block. Personally I'm
|
6
|
-
still toying with how it can be used and working to find clever tricks with it.
|
7
|
-
|
8
|
-
_That being said, this is a 5 minute hack. You've been warned._
|
9
|
-
|
10
|
-
Piping is simple, we take the object and put a pipe on it:
|
11
|
-
```ruby
|
12
|
-
1.pipe { |x| "#{x} is great!" }
|
13
|
-
# => '1 is great!'
|
14
|
-
```
|
15
|
-
|
16
|
-
How do you get going with pipe?
|
17
|
-
```ruby
|
18
|
-
include Pipeable
|
19
|
-
```
|
20
|
-
...and your object is ready to go!
|
21
|
-
|
22
|
-
## Installation
|
23
|
-
|
24
|
-
Add this line to your application's Gemfile:
|
25
|
-
|
26
|
-
gem 'pipeable'
|
27
|
-
|
28
|
-
And then execute:
|
29
|
-
|
30
|
-
$ bundle
|
31
|
-
|
32
|
-
Or install it yourself as:
|
33
|
-
|
34
|
-
$ gem install pipeable
|
35
|
-
|
36
|
-
## Usage
|
37
|
-
|
38
|
-
Slap a pipe on the end of it!
|
39
|
-
|
40
|
-
## Contributing
|
41
|
-
|
42
|
-
1. Fork it ( http://github.com/baweaver/pipeable/fork )
|
43
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
-
5. Create new Pull Request
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|