mayak 0.0.13 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mayak/function.rb +19 -0
- data/mayak.gemspec +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: 8217e22d103f9b3a253973f90f330d3b69d98320919c85b28a9d05df42c9b901
|
4
|
+
data.tar.gz: 89e2f9a86616f036129b0c31b09d864b811067febc4b31191a6d98ef1b332774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e44eddcb1be94600d1501ecfbac8690557c233410ebb5a470e669201a40d564aafe00ea358027fe78887b893dc3b7cc0fb1aaa6be8f02d9d75ea19ac64abed2c
|
7
|
+
data.tar.gz: 2238e28cfd575b50f0a2fc6fb360485fd10c2fd754c441493f394bd289f3f38a5b54f13d952fbfa8ef09b85bbed9968f8245500ade2ae405bd5b12b93862e6cf
|
data/lib/mayak/function.rb
CHANGED
@@ -18,6 +18,25 @@ module Mayak
|
|
18
18
|
@blk = T.let(blk, T.proc.params(input: Input).returns(Output))
|
19
19
|
end
|
20
20
|
|
21
|
+
sig {
|
22
|
+
type_parameters(
|
23
|
+
:Input,
|
24
|
+
:Output
|
25
|
+
).params(
|
26
|
+
proc: T.proc.params(arg0: T.type_parameter(:Input)).returns(T.type_parameter(:Output))
|
27
|
+
).returns(
|
28
|
+
::Mayak::Function[T.type_parameter(:Input), T.type_parameter(:Output)]
|
29
|
+
)
|
30
|
+
}
|
31
|
+
def self.from_proc(proc)
|
32
|
+
::Mayak::Function[T.type_parameter(:Input), T.type_parameter(:Output)].new { |input| proc.call(input) }
|
33
|
+
end
|
34
|
+
|
35
|
+
sig { returns(T.proc.params(arg0: Input).returns(Output)) }
|
36
|
+
def to_proc
|
37
|
+
-> (input) { call(input) }
|
38
|
+
end
|
39
|
+
|
21
40
|
sig { params(input: Input).returns(Output) }
|
22
41
|
def call(input)
|
23
42
|
blk.call(input)
|
data/mayak.gemspec
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "mayak"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.15"
|
8
8
|
spec.summary = "Set of fully typed utility classes and interfaces integrated with Sorbet."
|
9
9
|
spec.description = spec.summary
|
10
10
|
spec.authors = ["Daniil Bober"]
|