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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 885c4168416d2e48d2cd90e6b112513d0dc0a7de30d9de6f4c64e2769ce14913
4
- data.tar.gz: 037c966d1c4cf2392fc88a69284dda12935d04086b345bf2ce9e8feec16bf343
3
+ metadata.gz: 3e0aa08638b53d5dc7005d8754db2e991a9529d439ebedef96baa7fb4ef0e67b
4
+ data.tar.gz: 16cab1671faa230b629f19c68d2b16835e3b2e9406085b8e08ae1281194c2273
5
5
  SHA512:
6
- metadata.gz: 7917a9df4b514d268d694f1c736bd426c6f09c51fb56d7c903c4ffa1e0a58917dacda534d912897cc095fea6e2f70ad2fa83916374299b91510f17c30bf0f9a5
7
- data.tar.gz: f3fe94c802be05f8b970c33a8adf59d18028e83285e79e2cdf601ee9e805d2e375f3575e43b81bc1a3632c1b99732f550b3c8ca429407420ad19cf61c10ed7ea
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 Definer < Module
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
- descendant.include instance_module
21
+
22
+ freeze
25
23
  end
26
24
 
27
25
  private
28
26
 
29
- attr_reader :container, :pipe, :instance_module
27
+ attr_reader :container, :pipe
30
28
 
31
29
  def define_pipe pipeline = pipe
32
- instance_module.define_method :pipe do |input, *steps|
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
- instance_module.class_exec container do |dependencies|
40
- dependencies.each_key do |name|
41
- define_method name do |*positionals, **keywords, &block|
42
- step = dependencies[name]
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.included(descendant) = descendant.include Definer.new
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.3.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 = "An implementation of the Railway Pattern for functional composable pipelines."
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.3.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-21 00:00:00.000000000 Z
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: An implementation of the Railway Pattern for functional composable pipelines.
170
+ summary: A domain specific language for building functionally composable steps.
171
171
  test_files: []
metadata.gz.sig CHANGED
Binary file