kurangu 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/signature.rb +6 -3
  3. data/lib/trace.rb +3 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbd6e9e2d7412e8274e1c9ac079589bb0103ca27
4
- data.tar.gz: 322c6cc9d6d1091454ce77b3881c144d82f773e1
3
+ metadata.gz: b865407c12e193a82d44ff98340ad395b4cf1fd8
4
+ data.tar.gz: dbef6cd12b4b4187e070b1c0951e29836b467fbc
5
5
  SHA512:
6
- metadata.gz: 4b44400e6dd7b468721562c8549c517f26ae23a7b92333c850b42a183809109767561e96055e8db2d751843a8cae1b3a8edc6e07b6c4cca2ed4fcfff76cf038f
7
- data.tar.gz: 789087dd384888c2719cf089ae4e5c7ff16b550ee045f4828588b23763c860a43eb50f087d249210a2d0248f0bb3c6ea6bc3ac26f20f2a86ed26f48ce95b062a
6
+ metadata.gz: f40a07094d28f21f337183ad5405dcf6172049532cca8949f24cb05d805d173114376d4611688073a39f24af9bfcc0da2b915f1386848f75d49aff1665826995
7
+ data.tar.gz: c8b15b45e951120b729bad1163706a448b32ab74eb5137e9e650e42328de72c5c20c4bcd0765b999509062e0467d46cec1d3d8dc790027dd91d50854ce9fa8cc
data/lib/signature.rb CHANGED
@@ -18,14 +18,17 @@ class MethodSignature
18
18
  end
19
19
 
20
20
  def to_s
21
- signatures = @signatures.to_a.map { |a|
22
- "#{@line} type '(#{a[0]}) -> #{a[1].to_a.join(" or ")}'"
21
+ signatures = @signatures.to_a.map { |a|
22
+ "#{@line} type '(#{a[0]}) -> #{a[1].to_a.join(" or ")}'"
23
23
  }
24
24
  signatures.join("\n")
25
25
  end
26
26
 
27
- def add(parameter_types, return_type)
27
+ def add(parameter_types, return_type, owner)
28
28
  parameter_signature = generate_parameter_signature(parameter_types)
29
+ if return_type.to_s == owner.class.name
30
+ return_type = "self"
31
+ end
29
32
  @signatures[parameter_signature].add(return_type)
30
33
  end
31
34
 
data/lib/trace.rb CHANGED
@@ -23,9 +23,10 @@ trace_return = TracePoint.new(:return) do |t|
23
23
  if args
24
24
  line = t.self.method(t.method_id).source_location[1]
25
25
  if !signatures.key?(s)
26
- signatures[s] = MethodSignature.new(line, t.self.method(t.method_id).parameters)
26
+ parameters = t.self.method(t.method_id).parameters
27
+ signatures[s] = MethodSignature.new(line, parameters)
27
28
  end
28
- signatures[s].add(args, t.return_value.class)
29
+ signatures[s].add(args, t.return_value.class, t.self)
29
30
  path = "#{t.path}.annotations"
30
31
  dir = File.dirname(t.path)
31
32
  write_annotations_paths(dir, paths.add(path))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kurangu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arpith Siromoney