kurangu 0.0.8 → 0.0.9
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/lib/signature.rb +5 -2
- data/lib/trace.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ec20260877ae23ba6d5a2fa4e57a53dd703746d
|
4
|
+
data.tar.gz: 2d9c55264b168bedb566b72265ba7dcd10d1481c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a056fd987348548a9432742d2bf5033d2a98bf8b7832464dc2aa63f6c8ccfa3769d78da0c4142a9b51611a399db91be3cef118cf72385c2f1902f4c165b8959c
|
7
|
+
data.tar.gz: e91f82c29a47ceaa43c804c448a7c8501279f2a5943f30560e1d850f900daf88f3347ea7df2b359022a2f6c0fb617c519d656c6ef5286ac11c8cf2970e03f52a
|
data/lib/signature.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
class MethodSignature
|
2
|
-
def initialize(line, parameters)
|
2
|
+
def initialize(line, class_name, method_id, parameters)
|
3
3
|
@line = line
|
4
|
+
@class_name = class_name
|
5
|
+
@method_id = method_id
|
4
6
|
@parameters = parameters
|
5
7
|
# For each parameter signature (key), store a set of return types (value)
|
6
8
|
@signatures = Hash.new { | h, k | h[k] = Set.new }
|
@@ -19,7 +21,8 @@ class MethodSignature
|
|
19
21
|
|
20
22
|
def to_s
|
21
23
|
signatures = @signatures.to_a.map { |a|
|
22
|
-
"#{@
|
24
|
+
prefix = "#{@class_name}, :#{@method_id}"
|
25
|
+
"#{@line} type #{prefix}, '(#{a[0]}) -> #{a[1].to_a.join(" or ")}'"
|
23
26
|
}
|
24
27
|
signatures.join("\n")
|
25
28
|
end
|
data/lib/trace.rb
CHANGED
@@ -24,7 +24,7 @@ trace_return = TracePoint.new(:return) do |t|
|
|
24
24
|
line = t.self.method(t.method_id).source_location[1]
|
25
25
|
if !signatures.key?(s)
|
26
26
|
parameters = t.self.method(t.method_id).parameters
|
27
|
-
signatures[s] = MethodSignature.new(line, parameters)
|
27
|
+
signatures[s] = MethodSignature.new(line, t.defined_class, t.method_id, parameters)
|
28
28
|
end
|
29
29
|
signatures[s].add(args, t.return_value.class, t.self)
|
30
30
|
path = "#{t.path}.annotations"
|