proc 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proc/callable.rb +1 -1
- data/lib/proc/client.rb +2 -2
- data/lib/proc/composition.rb +17 -3
- data/lib/proc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63fefe7d8d6f97ef667ca24f07ef5f38b402c6982d783582d6ea869dbfc67c76
|
4
|
+
data.tar.gz: ceaeee3d8d634ba9d9ba6771266554e8dc7b8662b819751520658b0e657dbfa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c44c09c6526286bbcc8e67fefd1c2d13cb5dec65b4471452eb07c9845f36e8c2aa92dcd7c5080ff7070a2a1228b6f3667c7d9616f35e37ba7d14ec9f882ac22
|
7
|
+
data.tar.gz: a38fe68ec69ed2b086741d46728245d3351fe58ed26c956fcb9ec67257e9089b9e2e383a8551530bed293188f6e14ca9799ebaf57859163bf1b9fbd0bfb26f82
|
data/lib/proc/callable.rb
CHANGED
data/lib/proc/client.rb
CHANGED
@@ -79,12 +79,12 @@ class Proc
|
|
79
79
|
}.merge(DEFAULT_HEADERS)
|
80
80
|
|
81
81
|
begin
|
82
|
-
response = super(:post, build_uri(proc), headers: headers, body: Oj.dump(body, mode: :
|
82
|
+
response = super(:post, build_uri(proc), headers: headers, body: Oj.dump(body, mode: :custom), task: task)
|
83
83
|
|
84
84
|
@remaining = response.headers["x-rate-limit-remaining"].to_s.to_i
|
85
85
|
@resets_at = Time.at(response.headers["x-rate-limit-reset"].to_s.to_i)
|
86
86
|
|
87
|
-
payload = Oj.load(response.read, mode: :
|
87
|
+
payload = Oj.load(response.read, mode: :compat)
|
88
88
|
rescue => error
|
89
89
|
raise Proc::Unavailable, error.message
|
90
90
|
ensure
|
data/lib/proc/composition.rb
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
class Proc
|
4
4
|
class Composition
|
5
|
-
def initialize(client:)
|
5
|
+
def initialize(client:, input:, callables: [])
|
6
6
|
@client = client
|
7
|
-
@
|
7
|
+
@input = input
|
8
|
+
@callables = callables
|
8
9
|
end
|
9
10
|
|
10
11
|
def initialize_copy(_)
|
@@ -12,7 +13,11 @@ class Proc
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def call(input = input_omitted = true, **arguments)
|
15
|
-
@client.call("exec", input_omitted ? @
|
16
|
+
@client.call("exec", input_omitted ? @input : input, proc: serialized_calls)
|
17
|
+
end
|
18
|
+
|
19
|
+
def with(input = input_omitted = true)
|
20
|
+
self.class.new(client: @client, input: input_omitted ? @input : input, callables: @callables.dup)
|
16
21
|
end
|
17
22
|
|
18
23
|
def >>(other)
|
@@ -26,6 +31,15 @@ class Proc
|
|
26
31
|
end
|
27
32
|
|
28
33
|
def serialize
|
34
|
+
{
|
35
|
+
"{}" => {
|
36
|
+
"<<" => @input,
|
37
|
+
"[]" => serialized_calls
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def serialized_calls
|
29
43
|
@callables.map { |callable|
|
30
44
|
[callable.proc, callable.serialized_arguments]
|
31
45
|
}
|
data/lib/proc/version.rb
CHANGED