pipeable 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/pipeable/{definer.rb → builder.rb} +11 -15
- data/lib/pipeable.rb +3 -8
- data/pipeable.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e0aa08638b53d5dc7005d8754db2e991a9529d439ebedef96baa7fb4ef0e67b
|
4
|
+
data.tar.gz: 16cab1671faa230b629f19c68d2b16835e3b2e9406085b8e08ae1281194c2273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a029e0fe184140e2ccb0649753d19c2250e5231df82ef2fd8961e74e622330090891288db8654e5d0282ff41b459587901b14dba37426407d6fd31ba6b53cc
|
7
|
+
data.tar.gz: 31a1d08c5c4f068fdf04bfcc92b21308ff1eee4e551da94db16557d7b6c2b3621c90728519addf1ac0e101134b2056450017f1e0f7cab83ee098dcc0cb2e5174
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -5,43 +5,39 @@ require "refinements/array"
|
|
5
5
|
|
6
6
|
module Pipeable
|
7
7
|
# Defines the pipe and and associated step methods for an object.
|
8
|
-
class
|
8
|
+
class Builder < Module
|
9
9
|
include Dry::Monads[:result]
|
10
10
|
|
11
11
|
using Refinements::Array
|
12
12
|
|
13
13
|
def initialize container = Steps::Container, pipe: Pipe
|
14
14
|
super()
|
15
|
+
|
15
16
|
@container = container
|
16
17
|
@pipe = pipe
|
17
|
-
@instance_module = Class.new(Module).new
|
18
|
-
end
|
19
18
|
|
20
|
-
def included descendant
|
21
|
-
super
|
22
19
|
define_pipe
|
23
20
|
define_steps
|
24
|
-
|
21
|
+
|
22
|
+
freeze
|
25
23
|
end
|
26
24
|
|
27
25
|
private
|
28
26
|
|
29
|
-
attr_reader :container, :pipe
|
27
|
+
attr_reader :container, :pipe
|
30
28
|
|
31
29
|
def define_pipe pipeline = pipe
|
32
|
-
|
30
|
+
define_method :pipe do |input, *steps|
|
33
31
|
steps.each { |step| steps.supplant step, method(step) if step.is_a? Symbol }
|
34
32
|
pipeline.call(input, *steps)
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
|
-
def define_steps
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
step.is_a?(Proc) ? step : step.new(*positionals, **keywords, &block)
|
44
|
-
end
|
36
|
+
def define_steps vessel = container
|
37
|
+
vessel.each_key do |key|
|
38
|
+
define_method key do |*positionals, **keywords, &block|
|
39
|
+
step = vessel[key]
|
40
|
+
step.is_a?(Proc) ? step : step.new(*positionals, **keywords, &block)
|
45
41
|
end
|
46
42
|
end
|
47
43
|
end
|
data/lib/pipeable.rb
CHANGED
@@ -10,16 +10,11 @@ end
|
|
10
10
|
|
11
11
|
# Main namespace.
|
12
12
|
module Pipeable
|
13
|
-
def self.
|
13
|
+
def self.[](container) = Builder.new(container)
|
14
|
+
|
15
|
+
def self.included(descendant) = descendant.include Builder.new
|
14
16
|
|
15
17
|
def self.loader registry = Zeitwerk::Registry
|
16
18
|
@loader ||= registry.loaders.find { |loader| loader.tag == File.basename(__FILE__, ".rb") }
|
17
19
|
end
|
18
|
-
|
19
|
-
def self.[](container) = Definer.new(container)
|
20
|
-
|
21
|
-
def self.with(...)
|
22
|
-
warn "`#{self.class}.#{__method__}` is deprecated, use `.[]` instead.", category: :deprecated
|
23
|
-
Definer.new(...)
|
24
|
-
end
|
25
20
|
end
|
data/pipeable.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "pipeable"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.4.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/pipeable"
|
9
|
-
spec.summary = "
|
9
|
+
spec.summary = "A domain specific language for building functionally composable steps."
|
10
10
|
spec.license = "Hippocratic-2.1"
|
11
11
|
|
12
12
|
spec.metadata = {
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipeable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-04-
|
38
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: containable
|
@@ -119,8 +119,8 @@ files:
|
|
119
119
|
- LICENSE.adoc
|
120
120
|
- README.adoc
|
121
121
|
- lib/pipeable.rb
|
122
|
+
- lib/pipeable/builder.rb
|
122
123
|
- lib/pipeable/composable.rb
|
123
|
-
- lib/pipeable/definer.rb
|
124
124
|
- lib/pipeable/pipe.rb
|
125
125
|
- lib/pipeable/steps/abstract.rb
|
126
126
|
- lib/pipeable/steps/as.rb
|
@@ -167,5 +167,5 @@ requirements: []
|
|
167
167
|
rubygems_version: 3.5.9
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
|
-
summary:
|
170
|
+
summary: A domain specific language for building functionally composable steps.
|
171
171
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|