proc 0.12.1 → 0.15.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: bf87f2913659211107f5af2ac54f61887291e8cbbcfe060e93044bc7cc7be8f2
4
- data.tar.gz: 2b17972efabec76c0a5281aae6b4d07136c5841301fa4b2bf3cebcfefe32cd82
3
+ metadata.gz: 9c4e2f8e75f833c305540a05b7a5fb4b401f954296a68e8bd06dabf89be7042d
4
+ data.tar.gz: d254fb835c6d38bae8a7d5c2232f50cd05387ba7324280d1ba3c1761dec4525f
5
5
  SHA512:
6
- metadata.gz: ef1780eeb35c9a584403e41a54eb0f30f9759439f5477940765017baacd16626eef7af15f6291fbdf7e67a4fe464e5419cff83c1c47d1ab27094af2c078654cb
7
- data.tar.gz: b6c82ad621724a2062e767d68006d06f4cfdbb4740942a658b87275b46bb1b5c773fa07f8e6d8a05959dabe06255cdf6e94d51cffe197900cbd49719e61030fe
6
+ metadata.gz: 022c5d8baf6791533e5d5407831a512e922f0013df71da6f35b4595f5c9ee6fc4a85cb01e909a9c9d9c2113a50be0a5818fe8a81ab3169d74fb2a0230b41912e
7
+ data.tar.gz: 41656a469f4b6505578ff2ecc0da00b77f3178904d8167964e4bdb6adbdcc9346230b9b9a1e1501be649993e7e475437a6727f83d4e1786d75fafb7036798f29
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [v0.15.0](https://github.com/metabahn/proc/releases/tag/2022-01-13)
2
+
3
+ *released on 2022-01-13*
4
+
5
+ * `dep` [#22](https://github.com/metabahn/proc/pull/22) Update dependencies ([bryanp](https://github.com/bryanp))
6
+ * `chg` [#20](https://github.com/metabahn/proc/pull/20) Rename client `request_count` to `count` ([bryanp](https://github.com/bryanp))
7
+ * `chg` [#16](https://github.com/metabahn/proc/pull/16) Update Ruby client to use proc.run ([bryanp](https://github.com/bryanp))
8
+
9
+ ## [v0.14.0](https://github.com/metabahn/proc/releases/tag/2021-09-22)
10
+
11
+ *released on 2021-09-22*
12
+
13
+ * `chg` [#14](https://github.com/metabahn/proc/pull/14) Change Ruby client error handling to fallback to returning a result ([bryanp](https://github.com/bryanp))
14
+
15
+ ## [v0.13.0](https://github.com/metabahn/proc/releases/tag/2021-09-15)
16
+
17
+ *released on 2021-09-15*
18
+
19
+ * `chg` [#10](https://github.com/metabahn/proc/pull/10) Extract proc-composer from the proc client library for ruby ([bryanp](https://github.com/bryanp))
20
+ * `chg` [#7](https://github.com/metabahn/proc/pull/7) Update Ruby client to call api.proc.dev ([bryanp](https://github.com/bryanp))
21
+ * `add` [#3](https://github.com/metabahn/proc/pull/3) Introduce global authorization/instance to the Ruby client ([bryanp](https://github.com/bryanp))
22
+
1
23
  ## [v0.12.1](https://github.com/metabahn/proc/releases/tag/2021-05-13)
2
24
 
3
25
  *released on 2021-05-13*
data/lib/proc/callable.rb CHANGED
@@ -1,19 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Proc
4
- class Callable < BasicObject
5
- attr_reader :proc, :input, :arguments
4
+ class Callable < Composer::Callable
5
+ inspects :@client
6
6
 
7
- def initialize(proc, client:, input: ::Proc.undefined, arguments: {})
8
- @proc = proc.to_s
7
+ def initialize(proc, client:, **kwargs)
9
8
  @client = client
10
- @input = input
11
- @arguments = arguments
12
- end
13
9
 
14
- def initialize_copy(_)
15
- @input = input.dup
16
- @arguments = arguments.dup
10
+ super(proc, **kwargs)
17
11
  end
18
12
 
19
13
  # [public] Dispatches this callable context to proc using the client.
@@ -25,12 +19,7 @@ class Proc
25
19
  arguments[:proc] = yield
26
20
  end
27
21
 
28
- callable = ::Proc::Callable.new(
29
- @proc,
30
- client: @client,
31
- input: input_omitted ? @input : input,
32
- arguments: @arguments.merge(arguments)
33
- )
22
+ callable = build_callable(input: input_omitted ? @input : input, arguments: @arguments.merge(arguments))
34
23
 
35
24
  @client.call(@proc, callable.input, **callable.arguments)
36
25
  end
@@ -38,132 +27,17 @@ class Proc
38
27
  # [public] Dispatches this callable context to proc using the client, calling the given block once for each value.
39
28
  #
40
29
  def each(input = input_omitted = true, **arguments, &block)
41
- callable = ::Proc::Callable.new(
42
- @proc,
43
- client: @client,
44
- input: input_omitted ? @input : input,
45
- arguments: @arguments.merge(arguments)
46
- )
30
+ callable = build_callable(input: input_omitted ? @input : input, arguments: @arguments.merge(arguments))
47
31
 
48
32
  @client.call(@proc, callable.input, **callable.arguments, &block)
49
33
  end
50
34
 
51
- # [public] Creates a new callable context based on this one, with a new input and/or arguments.
52
- #
53
- def with(input = input_omitted = true, **arguments)
54
- if ::Kernel.block_given?
55
- arguments[:proc] = yield
56
- end
57
-
58
- ::Proc::Callable.new(
59
- @proc,
60
- client: @client,
61
- input: input_omitted ? @input : input,
62
- arguments: @arguments.merge(arguments)
63
- )
64
- end
65
-
66
- # [public] Returns a composition built from this callable context and one or more other callables.
67
- #
68
- def compose(*others)
69
- composed = ::Proc::Composition.new(client: @client, input: @input)
70
- composed << self
71
- others.each { |other| composed << other }
72
- composed
73
- end
74
-
75
- # [public] Returns a composition built from this callable context and another callable.
76
- #
77
- def >>(other)
78
- composed = ::Proc::Composition.new(client: @client, input: @input)
79
- composed << self
80
- composed << other
81
- composed
82
- end
83
-
84
- def serialize(unwrapped: false)
85
- serialized = ["()", @proc]
86
-
87
- unless ::Proc.undefined?(@input)
88
- serialized << [">>", serialized_input]
89
- end
90
-
91
- serialized.concat(serialized_arguments)
92
-
93
- if unwrapped
94
- serialized
95
- else
96
- ["{}", serialized]
97
- end
98
- end
99
-
100
- def serialized_input
101
- serialize_value(@input)
102
- end
103
-
104
- def serialized_arguments
105
- @arguments.map { |key, value|
106
- ["$$", key.to_s, serialize_value(value)]
107
- }
108
- end
109
-
110
- # [public] Returns a callable context for `proc`, nested within this callable context.
111
- #
112
- def [](proc)
113
- arguments = if ::Kernel.block_given?
114
- duped = @arguments.dup
115
- duped[:proc] = yield
116
- duped
117
- else
118
- @arguments
119
- end
120
-
121
- ::Proc::Callable.new(
122
- [@proc, proc].join("."),
123
- client: @client,
124
- input: @input,
125
- arguments: arguments
126
- )
35
+ private def build_callable(input:, arguments:, proc: @proc)
36
+ ::Proc::Callable.new(proc, client: @client, input: input, arguments: arguments)
127
37
  end
128
38
 
129
- IGNORE_MISSING = %i[to_hash].freeze
130
-
131
- # [public] Allows nested callable contexts to be built through method lookups.
132
- #
133
- def method_missing(name, input = input_omitted = true, **arguments)
134
- if IGNORE_MISSING.include?(name)
135
- super
136
- else
137
- if ::Kernel.block_given?
138
- arguments[:proc] = yield
139
- end
140
-
141
- ::Proc::Callable.new(
142
- [@proc, name].join("."),
143
- client: @client,
144
- input: input_omitted ? @input : input,
145
- arguments: @arguments.merge(arguments)
146
- )
147
- end
148
- end
149
-
150
- def respond_to_missing?(name, *)
151
- if IGNORE_MISSING.include?(name)
152
- super
153
- else
154
- true
155
- end
156
- end
157
-
158
- private def serialize_value(value)
159
- case value
160
- when ::Symbol
161
- ["@@", value.to_s, {}]
162
- when ::Proc::Argument, ::Proc::Callable, ::Proc::Composition
163
- value.serialize
164
- else
165
- ["%%", value]
166
- end
39
+ private def build_composition(input:)
40
+ ::Proc::Composition.new(client: @client, input: input)
167
41
  end
168
42
  end
169
43
  end
data/lib/proc/client.rb CHANGED
@@ -1,14 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "core/async"
4
+ require "core/global"
5
+ require "core/inspect"
6
+
4
7
  require "http"
5
8
  require "msgpack"
6
9
 
10
+ require "proc/composer"
11
+
7
12
  require_relative "msgpack/types/decimal"
8
13
  MessagePack::DefaultFactory.register_type(0x00, Proc::Msgpack::Types::Decimal)
9
14
  MessagePack::DefaultFactory.register_type(-1, Time, packer: MessagePack::Time::Packer, unpacker: MessagePack::Time::Unpacker)
10
15
 
11
- require_relative "argument"
12
16
  require_relative "callable"
13
17
  require_relative "composition"
14
18
  require_relative "enumerator"
@@ -57,7 +61,24 @@ class Proc
57
61
  # [public] Connection to proc, configured with an authorization.
58
62
  #
59
63
  class Client < BasicObject
64
+ class << self
65
+ def authorization
66
+ ::ENV.fetch("PROC_AUTH") {
67
+ auth_file_path = ::Pathname.new("~/.proc/auth").expand_path
68
+
69
+ if auth_file_path.exist?
70
+ auth_file_path.read
71
+ else
72
+ ""
73
+ end
74
+ }.strip
75
+ end
76
+ end
77
+
60
78
  include ::Is::Async
79
+ include ::Is::Global
80
+ include ::Is::Inspectable
81
+ inspects :@scheme, :@host, ::Core::Inspect::Inspection.new(name: :@authorization, resolver: :safe_authorization), :@count
61
82
 
62
83
  # [public] The configured authorization.
63
84
  #
@@ -73,7 +94,7 @@ class Proc
73
94
 
74
95
  # [public] The number of requests this client has performed.
75
96
  #
76
- attr_reader :request_count
97
+ attr_reader :count
77
98
 
78
99
  attr_reader :response
79
100
 
@@ -82,11 +103,11 @@ class Proc
82
103
  "content-type" => "application/vnd.proc+msgpack"
83
104
  }.freeze
84
105
 
85
- def initialize(authorization, scheme: "https", host: "proc.dev")
106
+ def initialize(authorization = ::Proc::Client.authorization, scheme: "https", host: "proc.run")
86
107
  @authorization = authorization
87
108
  @scheme = scheme
88
109
  @host = host
89
- @request_count = 0
110
+ @count = 0
90
111
 
91
112
  @__base_url = "#{@scheme}://#{host}"
92
113
  @__headers = {
@@ -135,10 +156,10 @@ class Proc
135
156
  #
136
157
  # If a block is passed and the proc returns an enumerable, the block will be called with each value.
137
158
  #
138
- def call(proc = nil, input = ::Proc.undefined, **arguments, &block)
159
+ def call(proc = nil, input = ::Proc::Composer.undefined, **arguments, &block)
139
160
  body = []
140
161
 
141
- unless ::Proc.undefined?(input)
162
+ unless ::Proc::Composer.undefined?(input)
142
163
  body << [">>", serialize_value(input)]
143
164
  end
144
165
 
@@ -146,30 +167,13 @@ class Proc
146
167
  body << ["$$", key.to_s, serialize_value(value)]
147
168
  end
148
169
 
170
+ process(proc: proc, body: body, input: input, arguments: arguments, &block)
171
+ end
172
+
173
+ private def process(proc:, body:, input:, arguments:, &block)
149
174
  status, headers, payload = get_payload(proc: proc, body: body)
150
175
 
151
176
  case status
152
- when 200
153
- result = extract_output(payload)
154
-
155
- if (cursor = headers["x-cursor"])
156
- enumerator = if cursor.empty?
157
- ::Proc::Enumerator.new(result)
158
- else
159
- ::Proc::Enumerator.new(result) {
160
- arguments[:cursor] = cursor.to_s
161
- call(proc, input, **arguments)
162
- }
163
- end
164
-
165
- if block
166
- enumerator.each(&block)
167
- else
168
- enumerator
169
- end
170
- else
171
- result
172
- end
173
177
  when 400
174
178
  ::Kernel.raise ::Proc::Invalid, extract_error_message(payload)
175
179
  when 401
@@ -189,14 +193,58 @@ class Proc
189
193
  when 508
190
194
  ::Kernel.raise ::Proc::Error, extract_error_message(payload)
191
195
  else
192
- ::Kernel.raise ::Proc::Error, "unhandled"
196
+ result = extract_output(payload)
197
+
198
+ if !result.nil?
199
+ if (cursor = headers["x-cursor"])
200
+ enumerator = if cursor.empty?
201
+ ::Proc::Enumerator.new(result)
202
+ else
203
+ ::Proc::Enumerator.new(result) {
204
+ arguments[:cursor] = cursor.to_s
205
+ call(proc, input, **arguments)
206
+ }
207
+ end
208
+
209
+ if block
210
+ enumerator.each(&block)
211
+ else
212
+ enumerator
213
+ end
214
+ else
215
+ result
216
+ end
217
+ elsif (error = extract_error_message(payload))
218
+ ::Kernel.raise ::Proc::Error, error
219
+ end
193
220
  end
194
221
  end
195
222
 
223
+ IGNORE_MISSING = %i[
224
+ ].freeze
225
+
226
+ KERNEL_DELEGATE = %i[
227
+ class
228
+ instance_variables
229
+ instance_variable_get
230
+ instance_variable_set
231
+ object_id
232
+ public_send
233
+ respond_to?
234
+ ].freeze
235
+
196
236
  # [public] Allows callable contexts to be built through method lookups.
197
237
  #
198
- def method_missing(name, input = input_omitted = true, *, **arguments)
199
- if input_omitted
238
+ def method_missing(name, input = input_omitted = true, *parameters, **arguments, &block)
239
+ if IGNORE_MISSING.include?(name)
240
+ super
241
+ elsif KERNEL_DELEGATE.include?(name)
242
+ if input_omitted
243
+ ::Kernel.instance_method(name).bind_call(self, *parameters, **arguments, &block)
244
+ else
245
+ ::Kernel.instance_method(name).bind_call(self, input, *parameters, **arguments, &block)
246
+ end
247
+ elsif input_omitted
200
248
  ::Proc::Callable.new(name, client: self, arguments: arguments)
201
249
  else
202
250
  ::Proc::Callable.new(name, client: self, input: input, arguments: arguments)
@@ -210,10 +258,17 @@ class Proc
210
258
  # [public] Builds a named argument with options.
211
259
  #
212
260
  def argument(name, **options)
213
- ::Proc::Argument.new(name, **options)
261
+ ::Proc::Composer::Argument.new(name, **options)
214
262
  end
215
263
  alias_method :arg, :argument
216
264
 
265
+ # [public] Returns a partial representation of the authorization that is safe to include in logs.
266
+ #
267
+ def safe_authorization
268
+ return unless @authorization
269
+ "#{@authorization[0..7]}...#{@authorization[-5..]}"
270
+ end
271
+
217
272
  private def build_uri(proc)
218
273
  ::File.join(@__base_url, proc.to_s.split(".").join("/"))
219
274
  end
@@ -222,16 +277,18 @@ class Proc
222
277
  case value
223
278
  when ::Symbol
224
279
  ["@@", value.to_s, {}]
225
- when ::Proc::Argument, ::Proc::Callable, ::Proc::Composition
226
- value.serialize
227
280
  else
228
- ["%%", value]
281
+ if value.respond_to?(:serialize)
282
+ value.serialize
283
+ else
284
+ ["%%", value]
285
+ end
229
286
  end
230
287
  end
231
288
 
232
289
  private def get_payload(proc:, body:)
233
290
  await {
234
- @request_count += 1
291
+ @count += 1
235
292
 
236
293
  response = ::HTTP.headers(@__headers).post(build_uri(proc), body: ::MessagePack.pack(body))
237
294
 
@@ -1,18 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Proc
4
- class Composition
5
- attr_reader :input, :callables, :arguments
4
+ class Composition < Composer::Composition
5
+ inspects :@client
6
6
 
7
- def initialize(client:, input:, callables: [], arguments: {})
7
+ def initialize(client:, **kwargs)
8
8
  @client = client
9
- @input = input
10
- @callables = callables
11
- @arguments = arguments
12
- end
13
9
 
14
- def initialize_copy(_)
15
- @callables = @callables.dup
10
+ super(**kwargs)
16
11
  end
17
12
 
18
13
  # [public] Dispatches this composition to proc using the client.
@@ -22,105 +17,29 @@ class Proc
22
17
  arguments[:proc] = yield
23
18
  end
24
19
 
25
- callable = self.class.new(
26
- client: @client,
20
+ callable = build_composition(
27
21
  input: input_omitted ? @input : input,
28
- callables: @callables.dup,
29
- arguments: @arguments.merge(arguments)
22
+ arguments: @arguments.merge(arguments),
23
+ callables: @callables.dup
30
24
  )
31
25
 
32
- @client.call("core.exec", Proc.undefined, proc: callable)
26
+ @client.call("core.exec", Proc::Composer.undefined, proc: callable)
33
27
  end
34
28
 
35
29
  # [public] Dispatches this composition to proc using the client, calling the given block once for each value.
36
30
  #
37
31
  def each(input = input_omitted = true, **arguments, &block)
38
- callable = self.class.new(
39
- client: @client,
40
- input: input_omitted ? @input : input,
41
- callables: @callables.dup,
42
- arguments: @arguments.merge(arguments)
43
- )
44
-
45
- @client.call("core.exec", Proc.undefined, proc: callable, &block)
46
- end
47
-
48
- # [public] Creates a new composition based on this one, with a new input and/or arguments.
49
- #
50
- def with(input = input_omitted = true, **arguments)
51
- if block_given?
52
- arguments[:proc] = yield
53
- end
54
-
55
- self.class.new(
32
+ callable = build_composition(
56
33
  client: @client,
57
34
  input: input_omitted ? @input : input,
58
- callables: @callables.dup,
59
35
  arguments: @arguments.merge(arguments)
60
36
  )
61
- end
62
-
63
- # [public] Returns a composition from this composition and one or more other callables.
64
- #
65
- def compose(*others)
66
- composed = dup
67
- others.each { |other| composed << other }
68
- composed
69
- end
70
-
71
- # [public] Returns a composition built from this composition and another callable.
72
- #
73
- def >>(other)
74
- composed = dup
75
- composed << other
76
- composed
77
- end
78
-
79
- def <<(callable)
80
- case callable
81
- when Composition
82
- merge(callable)
83
- when Callable
84
- @callables << callable
85
- end
86
- end
87
-
88
- def serialize
89
- serialized = ["{}"]
90
-
91
- unless Proc.undefined?(@input)
92
- serialized << [">>", serialized_input]
93
- end
94
-
95
- serialized + serialized_arguments + @callables.map { |callable| callable.serialize(unwrapped: true) }
96
- end
97
-
98
- def serialized_input
99
- serialize_value(@input)
100
- end
101
37
 
102
- def serialized_arguments
103
- @arguments.map { |key, value|
104
- ["$$", key.to_s, serialize_value(value)]
105
- }
38
+ @client.call("core.exec", Proc::Composer.undefined, proc: callable, &block)
106
39
  end
107
40
 
108
- def merge(composition)
109
- raise ArgumentError, "expected a composition" unless composition.is_a?(self.class)
110
-
111
- @callables.concat(composition.callables)
112
- @arguments.merge!(composition.arguments)
113
- end
114
-
115
- private def serialize_value(value)
116
- case value
117
- when Symbol
118
- ["@@", value.to_s, {}]
119
- when Argument, Callable, Composition
120
- value.serialize
121
- else
122
- ["%%", value]
123
- end
41
+ private def build_composition(callables:, input:, arguments:)
42
+ self.class.new(client: @client, input: input, callables: callables, arguments: arguments)
124
43
  end
125
44
  end
126
45
  end
@@ -1,9 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core/inspect"
4
+
3
5
  class Proc
4
6
  class Enumerator
5
7
  include Enumerable
6
8
 
9
+ include Is::Inspectable
10
+ inspects :@values
11
+
7
12
  attr_reader :values, :next_block
8
13
 
9
14
  def initialize(values, &next_block)
data/lib/proc/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Proc
4
- VERSION = "0.12.1"
4
+ VERSION = "0.15.0"
5
5
 
6
6
  # [public]
7
7
  #
data/lib/proc.rb CHANGED
@@ -7,16 +7,8 @@ class Proc
7
7
  class << self
8
8
  # [public] Connect a client with an authorization.
9
9
  #
10
- def connect(authorization, **options)
11
- Client.new(authorization, **options)
12
- end
13
-
14
- def undefined
15
- @_undefined ||= ::Object.new
16
- end
17
-
18
- def undefined?(value)
19
- value == undefined
10
+ def connect(authorization = Proc::Client.authorization, client: Proc::Client, **options)
11
+ client.new(authorization, **options)
20
12
  end
21
13
  end
22
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.15.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: 2021-05-13 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: core-async
@@ -16,14 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: '0.10'
20
20
  type: :runtime
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: 0.5.0
26
+ version: '0.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: core-global
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: core-inspect
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: http
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +80,20 @@ dependencies:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
82
  version: '1.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: proc-composer
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.0'
55
97
  description: Proc client library.
56
98
  email: bryan@metabahn.com
57
99
  executables: []
@@ -62,7 +104,6 @@ files:
62
104
  - LICENSE
63
105
  - README.md
64
106
  - lib/proc.rb
65
- - lib/proc/argument.rb
66
107
  - lib/proc/callable.rb
67
108
  - lib/proc/client.rb
68
109
  - lib/proc/composition.rb
@@ -88,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
129
  - !ruby/object:Gem::Version
89
130
  version: '0'
90
131
  requirements: []
91
- rubygems_version: 3.2.15
132
+ rubygems_version: 3.3.3
92
133
  signing_key:
93
134
  specification_version: 4
94
135
  summary: Proc client library.
data/lib/proc/argument.rb DELETED
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Proc
4
- class Argument
5
- def initialize(name, **options)
6
- @name = name
7
- @options = options
8
- end
9
-
10
- def serialize
11
- ["@@", @name.to_s, serialized_options]
12
- end
13
-
14
- def serialized_options
15
- @options.each_pair.each_with_object({}) { |(key, value), hash|
16
- hash[key.to_s] = serialize_value(value)
17
- }
18
- end
19
-
20
- private def serialize_value(value)
21
- if value.respond_to?(:serialize)
22
- value.serialize
23
- else
24
- ["%%", value]
25
- end
26
- end
27
- end
28
- end