proc 0.11.1 → 0.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 165ffe3b7cd5976e7091d46261724665b2ba65b8b40144d5b5a12bcfde0dcf21
4
- data.tar.gz: c79d592b4e21d9109268cc50929ae1f8f0e4daff8297fc3755da99bff05d47b5
3
+ metadata.gz: a554218f2f2a9cfe6bfa2e6f87ebf17abba0090e840d640ac5646c81b1d84c7c
4
+ data.tar.gz: cfdd2fab893016a3fb2a1a76995ee611c28cca6ea051024fae03157c22d440d9
5
5
  SHA512:
6
- metadata.gz: 02ce5abfc9089157d26a2430a3d6af2b74510d726698a5326a00c6f5cfa433f5a03d44e143cd8efb08d8b5ff6145cfde6a96746b4160cc584779c0be6f42005e
7
- data.tar.gz: 3e37e7b6d53001aec939303c7c7371f9fe63e78c874b5e00d14b652fcd0ca9aa2531d2e75e7083ee9cb1df56d9ebf53816c266c2fe17078cf7d76382b00bc7b3
6
+ metadata.gz: 8c82e014b6a876cbe35e9fdfdd2ea10e296e6497b207623728ca6dae8a887fb7ac82e7f199da08febec7571e677b65c743dbc335731c72f2716447f4f367b4db
7
+ data.tar.gz: 99c5bad156fbcb7d18084ee0523366f6334b5a9d5f2d89410fcad000a533a21be71806c53dea0f6b8f8d2f1ec36b488e86c65b36d5d4e067ca27e022f3f25bb1
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ ## [v0.13.0](https://github.com/metabahn/proc/releases/tag/2021-09-15)
2
+
3
+ *released on 2021-09-15*
4
+
5
+ * `chg` [#10](https://github.com/metabahn/proc/pull/10) Extract proc-composer from the proc client library for ruby ([bryanp](https://github.com/bryanp))
6
+ * `chg` [#7](https://github.com/metabahn/proc/pull/7) Update Ruby client to call api.proc.dev ([bryanp](https://github.com/bryanp))
7
+ * `add` [#3](https://github.com/metabahn/proc/pull/3) Introduce global authorization/instance to the Ruby client ([bryanp](https://github.com/bryanp))
8
+
9
+ ## [v0.12.1](https://github.com/metabahn/proc/releases/tag/2021-05-13)
10
+
11
+ *released on 2021-05-13*
12
+
13
+ * `chg` [#2](https://github.com/metabahn/proc/pull/2) Update http.rb dependency ([bryanp](https://github.com/bryanp))
14
+
15
+
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
- **This is the official Ruby client for Proc: Serverless web functions with superpowers.**
1
+ **Superpowers to help you ship web endpoints faster.**
2
+
3
+ Proc is an all-in-one toolchain for building, deploying, and calling custom behavior from any website or app.
2
4
 
3
5
  * [Learn more about Proc](https://proc.dev)
4
- * [Browse available packages](https://proc.dev/packages)
6
+ * [Browse packages](https://proc.dev/packages)
5
7
  * [Read the docs](https://proc.dev/docs)
6
- * [Join chat](https://discord.gg/aRu8qvkCmy)
8
+ * [Chat with us](https://discord.gg/aRu8qvkCmy)
7
9
 
8
10
  ## Install
9
11
 
@@ -31,7 +33,7 @@ client.type.number.add.call(1, {value: 1});
31
33
  => 2
32
34
  ```
33
35
 
34
- Build more complex behaviors by composing procs together:
36
+ Build more complex behavior by composing procs together:
35
37
 
36
38
  ```ruby
37
39
  time = client.time
@@ -43,7 +45,7 @@ composition.call
43
45
  => "Tuesday"
44
46
  ````
45
47
 
46
- Deploy custom endpoints instantly and call them from anywhere:
48
+ Instantly deploy your behavior to a private endpoint and call it from anywhere:
47
49
 
48
50
  ```ruby
49
51
  client.proc.create.call(name: "day_of_week", proc: composition)
data/lib/proc/callable.rb CHANGED
@@ -1,19 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Proc
4
- class Callable
5
- attr_reader :proc, :input, :arguments
6
-
7
- def initialize(proc, client:, input: Proc.undefined, arguments: {})
8
- @proc = proc.to_s
4
+ class Callable < Composer::Callable
5
+ def initialize(proc, client:, **kwargs)
9
6
  @client = client
10
- @input = input
11
- @arguments = arguments
12
- end
13
7
 
14
- def initialize_copy(_)
15
- @input = input.dup
16
- @arguments = arguments.dup
8
+ super(proc, **kwargs)
17
9
  end
18
10
 
19
11
  # [public] Dispatches this callable context to proc using the client.
@@ -21,16 +13,11 @@ class Proc
21
13
  # If a block is passed, it will be called to prior to dispatch and its result passed as a nested context.
22
14
  #
23
15
  def call(input = input_omitted = true, **arguments)
24
- if block_given?
16
+ if ::Kernel.block_given?
25
17
  arguments[:proc] = yield
26
18
  end
27
19
 
28
- callable = self.class.new(
29
- @proc,
30
- client: @client,
31
- input: input_omitted ? @input : input,
32
- arguments: @arguments.merge(arguments)
33
- )
20
+ callable = build_callable(input: input_omitted ? @input : input, arguments: @arguments.merge(arguments))
34
21
 
35
22
  @client.call(@proc, callable.input, **callable.arguments)
36
23
  end
@@ -38,131 +25,17 @@ class Proc
38
25
  # [public] Dispatches this callable context to proc using the client, calling the given block once for each value.
39
26
  #
40
27
  def each(input = input_omitted = true, **arguments, &block)
41
- callable = self.class.new(
42
- @proc,
43
- client: @client,
44
- input: input_omitted ? @input : input,
45
- arguments: @arguments.merge(arguments)
46
- )
28
+ callable = build_callable(input: input_omitted ? @input : input, arguments: @arguments.merge(arguments))
47
29
 
48
30
  @client.call(@proc, callable.input, **callable.arguments, &block)
49
31
  end
50
32
 
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 block_given?
55
- arguments[:proc] = yield
56
- end
57
-
58
- self.class.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 = 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 = 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 block_given?
114
- duped = @arguments.dup
115
- duped[:proc] = yield
116
- duped
117
- else
118
- @arguments
119
- end
120
-
121
- Callable.new(
122
- [@proc, proc].join("."),
123
- client: @client,
124
- input: @input,
125
- arguments: arguments
126
- )
33
+ private def build_callable(input:, arguments:, proc: @proc)
34
+ ::Proc::Callable.new(proc, client: @client, input: input, arguments: arguments)
127
35
  end
128
36
 
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 block_given?
138
- arguments[:proc] = yield
139
- end
140
-
141
- 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
- if value.is_a?(Symbol)
160
- ["@@", value.to_s, {}]
161
- elsif value.respond_to?(:serialize)
162
- value.serialize
163
- else
164
- ["%%", value]
165
- end
37
+ private def build_composition(input:)
38
+ ::Proc::Composition.new(client: @client, input: input)
166
39
  end
167
40
  end
168
41
  end
data/lib/proc/client.rb CHANGED
@@ -1,14 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "core/async"
4
+ require "core/global"
5
+
4
6
  require "http"
5
7
  require "msgpack"
6
8
 
9
+ require "proc/composer"
10
+
7
11
  require_relative "msgpack/types/decimal"
8
12
  MessagePack::DefaultFactory.register_type(0x00, Proc::Msgpack::Types::Decimal)
9
13
  MessagePack::DefaultFactory.register_type(-1, Time, packer: MessagePack::Time::Packer, unpacker: MessagePack::Time::Unpacker)
10
14
 
11
- require_relative "argument"
12
15
  require_relative "callable"
13
16
  require_relative "composition"
14
17
  require_relative "enumerator"
@@ -56,8 +59,23 @@ class Proc
56
59
 
57
60
  # [public] Connection to proc, configured with an authorization.
58
61
  #
59
- class Client
60
- include Is::Async
62
+ class Client < BasicObject
63
+ class << self
64
+ def authorization
65
+ ::ENV.fetch("PROC_AUTH") {
66
+ auth_file_path = ::Pathname.new("~/.proc/auth").expand_path
67
+
68
+ if auth_file_path.exist?
69
+ auth_file_path.read
70
+ else
71
+ ""
72
+ end
73
+ }.strip
74
+ end
75
+ end
76
+
77
+ include ::Is::Async
78
+ include ::Is::Global
61
79
 
62
80
  # [public] The configured authorization.
63
81
  #
@@ -82,7 +100,7 @@ class Proc
82
100
  "content-type" => "application/vnd.proc+msgpack"
83
101
  }.freeze
84
102
 
85
- def initialize(authorization, scheme: "https", host: "proc.dev")
103
+ def initialize(authorization = ::Proc::Client.authorization, scheme: "https", host: "api.proc.dev")
86
104
  @authorization = authorization
87
105
  @scheme = scheme
88
106
  @host = host
@@ -97,10 +115,10 @@ class Proc
97
115
  # [public] Returns a callable context for `proc`.
98
116
  #
99
117
  def [](proc)
100
- if block_given?
101
- Callable.new(proc, client: self, arguments: {proc: yield})
118
+ if ::Kernel.block_given?
119
+ ::Proc::Callable.new(proc, client: self, arguments: {proc: yield})
102
120
  else
103
- Callable.new(proc, client: self)
121
+ ::Proc::Callable.new(proc, client: self)
104
122
  end
105
123
  end
106
124
 
@@ -135,10 +153,10 @@ class Proc
135
153
  #
136
154
  # If a block is passed and the proc returns an enumerable, the block will be called with each value.
137
155
  #
138
- def call(proc = nil, input = Proc.undefined, **arguments, &block)
156
+ def call(proc = nil, input = ::Proc::Composer.undefined, **arguments, &block)
139
157
  body = []
140
158
 
141
- unless Proc.undefined?(input)
159
+ unless ::Proc::Composer.undefined?(input)
142
160
  body << [">>", serialize_value(input)]
143
161
  end
144
162
 
@@ -146,6 +164,10 @@ class Proc
146
164
  body << ["$$", key.to_s, serialize_value(value)]
147
165
  end
148
166
 
167
+ process(proc: proc, body: body, input: input, arguments: arguments, &block)
168
+ end
169
+
170
+ private def process(proc:, body:, input:, arguments:, &block)
149
171
  status, headers, payload = get_payload(proc: proc, body: body)
150
172
 
151
173
  case status
@@ -154,9 +176,9 @@ class Proc
154
176
 
155
177
  if (cursor = headers["x-cursor"])
156
178
  enumerator = if cursor.empty?
157
- Enumerator.new(result)
179
+ ::Proc::Enumerator.new(result)
158
180
  else
159
- Enumerator.new(result) {
181
+ ::Proc::Enumerator.new(result) {
160
182
  arguments[:cursor] = cursor.to_s
161
183
  call(proc, input, **arguments)
162
184
  }
@@ -171,25 +193,25 @@ class Proc
171
193
  result
172
194
  end
173
195
  when 400
174
- raise Proc::Invalid, extract_error_message(payload)
196
+ ::Kernel.raise ::Proc::Invalid, extract_error_message(payload)
175
197
  when 401
176
- raise Proc::Unauthorized, extract_error_message(payload)
198
+ ::Kernel.raise ::Proc::Unauthorized, extract_error_message(payload)
177
199
  when 403
178
- raise Proc::Forbidden, extract_error_message(payload)
200
+ ::Kernel.raise ::Proc::Forbidden, extract_error_message(payload)
179
201
  when 404
180
- raise Proc::Undefined, extract_error_message(payload)
202
+ ::Kernel.raise ::Proc::Undefined, extract_error_message(payload)
181
203
  when 408
182
- raise Proc::Timeout, extract_error_message(payload)
204
+ ::Kernel.raise ::Proc::Timeout, extract_error_message(payload)
183
205
  when 413
184
- raise Proc::Invalid, extract_error_message(payload)
206
+ ::Kernel.raise ::Proc::Invalid, extract_error_message(payload)
185
207
  when 429
186
- raise Proc::Limited, extract_error_message(payload)
208
+ ::Kernel.raise ::Proc::Limited, extract_error_message(payload)
187
209
  when 500
188
- raise Proc::Error, extract_error_message(payload)
210
+ ::Kernel.raise ::Proc::Error, extract_error_message(payload)
189
211
  when 508
190
- raise Proc::Error, extract_error_message(payload)
212
+ ::Kernel.raise ::Proc::Error, extract_error_message(payload)
191
213
  else
192
- raise Proc::Error, "unhandled"
214
+ ::Kernel.raise ::Proc::Error, "unhandled"
193
215
  end
194
216
  end
195
217
 
@@ -197,9 +219,9 @@ class Proc
197
219
  #
198
220
  def method_missing(name, input = input_omitted = true, *, **arguments)
199
221
  if input_omitted
200
- Callable.new(name, client: self, arguments: arguments)
222
+ ::Proc::Callable.new(name, client: self, arguments: arguments)
201
223
  else
202
- Callable.new(name, client: self, input: input, arguments: arguments)
224
+ ::Proc::Callable.new(name, client: self, input: input, arguments: arguments)
203
225
  end
204
226
  end
205
227
 
@@ -210,18 +232,19 @@ class Proc
210
232
  # [public] Builds a named argument with options.
211
233
  #
212
234
  def argument(name, **options)
213
- Argument.new(name, **options)
235
+ ::Proc::Composer::Argument.new(name, **options)
214
236
  end
215
237
  alias_method :arg, :argument
216
238
 
217
239
  private def build_uri(proc)
218
- File.join(@__base_url, proc.to_s.split(".").join("/"))
240
+ ::File.join(@__base_url, proc.to_s.split(".").join("/"))
219
241
  end
220
242
 
221
243
  private def serialize_value(value)
222
- if value.is_a?(Symbol)
244
+ case value
245
+ when ::Symbol
223
246
  ["@@", value.to_s, {}]
224
- elsif value.respond_to?(:serialize)
247
+ when ::Proc::Composer::Argument, ::Proc::Callable, ::Proc::Composition
225
248
  value.serialize
226
249
  else
227
250
  ["%%", value]
@@ -232,15 +255,15 @@ class Proc
232
255
  await {
233
256
  @request_count += 1
234
257
 
235
- response = HTTP.headers(@__headers).post(build_uri(proc), body: MessagePack.pack(body))
258
+ response = ::HTTP.headers(@__headers).post(build_uri(proc), body: ::MessagePack.pack(body))
236
259
 
237
260
  update_rate_limit(response)
238
261
  @response = response
239
262
 
240
- [response.status, response.headers, MessagePack.unpack(response.to_s)]
263
+ [response.status, response.headers, ::MessagePack.unpack(response.to_s)]
241
264
  }
242
265
  rescue
243
- raise Proc::Unavailable
266
+ ::Kernel.raise ::Proc::Unavailable
244
267
  end
245
268
 
246
269
  private def update_rate_limit(response)
@@ -256,7 +279,7 @@ class Proc
256
279
  end
257
280
 
258
281
  @rate_limit_reset = if (reset = response.headers["x-rate-limit-reset"])
259
- Time.at(reset.to_s.to_i)
282
+ ::Time.at(reset.to_s.to_i)
260
283
  end
261
284
  end
262
285
 
@@ -1,18 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Proc
4
- class Composition
5
- attr_reader :input, :callables, :arguments
6
-
7
- def initialize(client:, input:, callables: [], arguments: {})
4
+ class Composition < Composer::Composition
5
+ def initialize(client:, **kwargs)
8
6
  @client = client
9
- @input = input
10
- @callables = callables
11
- @arguments = arguments
12
- end
13
7
 
14
- def initialize_copy(_)
15
- @callables = @callables.dup
8
+ super(**kwargs)
16
9
  end
17
10
 
18
11
  # [public] Dispatches this composition to proc using the client.
@@ -22,104 +15,29 @@ class Proc
22
15
  arguments[:proc] = yield
23
16
  end
24
17
 
25
- callable = self.class.new(
26
- client: @client,
18
+ callable = build_composition(
27
19
  input: input_omitted ? @input : input,
28
- callables: @callables.dup,
29
- arguments: @arguments.merge(arguments)
20
+ arguments: @arguments.merge(arguments),
21
+ callables: @callables.dup
30
22
  )
31
23
 
32
- @client.call("core.exec", Proc.undefined, proc: callable)
24
+ @client.call("core.exec", Proc::Composer.undefined, proc: callable)
33
25
  end
34
26
 
35
27
  # [public] Dispatches this composition to proc using the client, calling the given block once for each value.
36
28
  #
37
29
  def each(input = input_omitted = true, **arguments, &block)
38
- callable = self.class.new(
30
+ callable = build_composition(
39
31
  client: @client,
40
32
  input: input_omitted ? @input : input,
41
- callables: @callables.dup,
42
33
  arguments: @arguments.merge(arguments)
43
34
  )
44
35
 
45
- @client.call("core.exec", Proc.undefined, proc: callable, &block)
36
+ @client.call("core.exec", Proc::Composer.undefined, proc: callable, &block)
46
37
  end
47
38
 
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(
56
- client: @client,
57
- input: input_omitted ? @input : input,
58
- callables: @callables.dup,
59
- arguments: @arguments.merge(arguments)
60
- )
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
-
102
- def serialized_arguments
103
- @arguments.map { |key, value|
104
- ["$$", key.to_s, serialize_value(value)]
105
- }
106
- end
107
-
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
- if value.is_a?(Symbol)
117
- ["@@", value.to_s, {}]
118
- elsif value.respond_to?(:serialize)
119
- value.serialize
120
- else
121
- ["%%", value]
122
- end
39
+ private def build_composition(callables:, input:, arguments:)
40
+ self.class.new(client: @client, input: input, callables: callables, arguments: arguments)
123
41
  end
124
42
  end
125
43
  end
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.11.1"
4
+ VERSION = "0.13.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.11.1
4
+ version: 0.13.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-04-19 00:00:00.000000000 Z
11
+ date: 2021-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: core-async
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: '0.6'
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.6'
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.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: http
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '4.4'
47
+ version: '5.0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '4.4'
54
+ version: '5.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: msgpack
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,23 +66,37 @@ dependencies:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '1.4'
55
- description: Proc Ruby client.
69
+ - !ruby/object:Gem::Dependency
70
+ name: proc-composer
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.0'
83
+ description: Proc client library.
56
84
  email: bryan@metabahn.com
57
85
  executables: []
58
86
  extensions: []
59
87
  extra_rdoc_files: []
60
88
  files:
89
+ - CHANGELOG.md
61
90
  - LICENSE
62
91
  - README.md
63
92
  - lib/proc.rb
64
- - lib/proc/argument.rb
65
93
  - lib/proc/callable.rb
66
94
  - lib/proc/client.rb
67
95
  - lib/proc/composition.rb
68
96
  - lib/proc/enumerator.rb
69
97
  - lib/proc/msgpack/types/decimal.rb
70
98
  - lib/proc/version.rb
71
- homepage: https://github.com/metabahn/proc-rb/
99
+ homepage: https://proc.dev
72
100
  licenses:
73
101
  - MPL-2.0
74
102
  metadata: {}
@@ -90,5 +118,5 @@ requirements: []
90
118
  rubygems_version: 3.2.15
91
119
  signing_key:
92
120
  specification_version: 4
93
- summary: Proc Ruby client.
121
+ summary: Proc client library.
94
122
  test_files: []
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