proc-composer 0.0.0 → 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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/proc/composer/argument.rb +4 -0
- data/lib/proc/composer/callable.rb +31 -6
- data/lib/proc/composer/composition.rb +10 -3
- data/lib/proc/composer/undefined.rb +13 -0
- data/lib/proc/composer/version.rb +1 -1
- data/lib/proc/composer.rb +2 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c699cc84ab92918eed69f823508c4d70e05f76f6ba3a2a7918876bf63df6689b
|
4
|
+
data.tar.gz: 0ee02ecc85802b6e17bb2cfd3cf9f1bd8d8dae6ae1a829be2b2022dbf4f64eb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c5d0833d8dfbfeefcdae12f8e085abd65612220157ffd42333dda680d6cc6767b5a090d598cd90b57b6bebcbaa1948903eca78baa24aa003a1166756112083
|
7
|
+
data.tar.gz: e54f68716b35aa794f9f8d97df1f5b3233ba4275418bbd36ac79613b570258f304ffc9981cbb138db466b4a83e743a64df1158d242bc395322043322f15c604e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## [v0.1.0](https://github.com/metabahn/proc/releases/tag/2022-01-13.1)
|
2
|
+
|
3
|
+
*released on 2022-01-13.1*
|
4
|
+
|
5
|
+
* `add` [#19](https://github.com/metabahn/proc/pull/19) Support inspection in clients, callables, and compositions ([bryanp](https://github.com/bryanp))
|
6
|
+
|
1
7
|
## [v0.0.0](https://github.com/metabahn/proc/releases/tag/2021-09-12)
|
2
8
|
|
3
9
|
*released on 2021-09-12*
|
@@ -1,8 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "core/inspect"
|
4
|
+
|
3
5
|
class Proc
|
4
6
|
module Composer
|
5
7
|
class Callable < BasicObject
|
8
|
+
include ::Is::Inspectable
|
9
|
+
inspects :@proc, :@input, :@arguments
|
10
|
+
|
6
11
|
attr_reader :proc, :input, :arguments
|
7
12
|
|
8
13
|
def initialize(proc, input: ::Proc::Composer.undefined, arguments: {})
|
@@ -85,15 +90,33 @@ class Proc
|
|
85
90
|
build_callable(proc: [@proc, proc].join("."), input: @input, arguments: arguments)
|
86
91
|
end
|
87
92
|
|
88
|
-
IGNORE_MISSING = %i[
|
93
|
+
IGNORE_MISSING = %i[
|
94
|
+
to_hash
|
95
|
+
].freeze
|
96
|
+
|
97
|
+
KERNEL_DELEGATE = %i[
|
98
|
+
class
|
99
|
+
instance_variables
|
100
|
+
instance_variable_get
|
101
|
+
instance_variable_set
|
102
|
+
object_id
|
103
|
+
public_send
|
104
|
+
respond_to?
|
105
|
+
].freeze
|
89
106
|
|
90
107
|
# [public] Allows nested callable contexts to be built through method lookups.
|
91
108
|
#
|
92
|
-
def method_missing(name, input = input_omitted = true, **arguments)
|
109
|
+
def method_missing(name, input = input_omitted = true, *parameters, **arguments, &block)
|
93
110
|
if IGNORE_MISSING.include?(name)
|
94
111
|
super
|
112
|
+
elsif KERNEL_DELEGATE.include?(name)
|
113
|
+
if input_omitted
|
114
|
+
::Kernel.instance_method(name).bind_call(self, *parameters, **arguments, &block)
|
115
|
+
else
|
116
|
+
::Kernel.instance_method(name).bind_call(self, input, *parameters, **arguments, &block)
|
117
|
+
end
|
95
118
|
else
|
96
|
-
if
|
119
|
+
if block
|
97
120
|
arguments[:proc] = yield
|
98
121
|
end
|
99
122
|
|
@@ -117,10 +140,12 @@ class Proc
|
|
117
140
|
case value
|
118
141
|
when ::Symbol
|
119
142
|
["@@", value.to_s, {}]
|
120
|
-
when ::Proc::Composer::Argument, ::Proc::Composer::Callable, ::Proc::Composer::Composition
|
121
|
-
value.serialize
|
122
143
|
else
|
123
|
-
|
144
|
+
if value.respond_to?(:serialize)
|
145
|
+
value.serialize
|
146
|
+
else
|
147
|
+
["%%", value]
|
148
|
+
end
|
124
149
|
end
|
125
150
|
end
|
126
151
|
|
@@ -1,8 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "core/inspect"
|
4
|
+
|
3
5
|
class Proc
|
4
6
|
module Composer
|
5
7
|
class Composition
|
8
|
+
include Is::Inspectable
|
9
|
+
inspects :@input, :@arguments, :@callables
|
10
|
+
|
6
11
|
attr_reader :input, :callables, :arguments
|
7
12
|
|
8
13
|
def initialize(input:, callables: [], arguments: {})
|
@@ -86,10 +91,12 @@ class Proc
|
|
86
91
|
case value
|
87
92
|
when Symbol
|
88
93
|
["@@", value.to_s, {}]
|
89
|
-
when Argument, Callable, Composition
|
90
|
-
value.serialize
|
91
94
|
else
|
92
|
-
|
95
|
+
if value.respond_to?(:serialize)
|
96
|
+
value.serialize
|
97
|
+
else
|
98
|
+
["%%", value]
|
99
|
+
end
|
93
100
|
end
|
94
101
|
end
|
95
102
|
|
data/lib/proc/composer.rb
CHANGED
@@ -3,12 +3,13 @@
|
|
3
3
|
require_relative "composer/argument"
|
4
4
|
require_relative "composer/callable"
|
5
5
|
require_relative "composer/composition"
|
6
|
+
require_relative "composer/undefined"
|
6
7
|
require_relative "composer/version"
|
7
8
|
|
8
9
|
class Proc
|
9
10
|
module Composer
|
10
11
|
def self.undefined
|
11
|
-
@_undefined ||= ::
|
12
|
+
@_undefined ||= Proc::Composer::Undefined.new
|
12
13
|
end
|
13
14
|
|
14
15
|
def self.undefined?(value)
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proc-composer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: core-inspect
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
13
27
|
description: Proc composer library.
|
14
28
|
email: bryan@metabahn.com
|
15
29
|
executables: []
|
@@ -23,6 +37,7 @@ files:
|
|
23
37
|
- lib/proc/composer/argument.rb
|
24
38
|
- lib/proc/composer/callable.rb
|
25
39
|
- lib/proc/composer/composition.rb
|
40
|
+
- lib/proc/composer/undefined.rb
|
26
41
|
- lib/proc/composer/version.rb
|
27
42
|
homepage: https://proc.dev
|
28
43
|
licenses:
|
@@ -43,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
58
|
- !ruby/object:Gem::Version
|
44
59
|
version: '0'
|
45
60
|
requirements: []
|
46
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.3.3
|
47
62
|
signing_key:
|
48
63
|
specification_version: 4
|
49
64
|
summary: Proc composer library.
|