method_call_tree 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Gemfile.lock +1 -1
- data/README.md +27 -7
- data/lib/method_call_tree.rb +4 -1
- data/lib/method_call_tree/version.rb +1 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6c0c624e60b8b0175434f4e97f84589b878d1d2df9a5bda88dd03287fc41b1e
|
4
|
+
data.tar.gz: be51e901388d2ec14fd5b0acaaf5f623764b6ec53eff6ffb20cef4662f7ca8d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19fbb970a223994b3f9b01a902a049e5c73e67d62ee5f4960e6c3fc6024e92922f7a68536b1f348384e1db1c57d6e8852c4e76df0f35d6da1bf13e29952b70b8
|
7
|
+
data.tar.gz: a371bb90304511ae35bb90d59e06dd7b9e8951a34bfa9d34f5bceccb842f2fd715d3684673ec4812dbac199dfbc9453714af38cd296c66316dd1211d9810d163
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -41,6 +41,23 @@ puts tree
|
|
41
41
|
|
42
42
|
result
|
43
43
|
|
44
|
+
```
|
45
|
+
foo
|
46
|
+
├───── bar
|
47
|
+
└───── baz
|
48
|
+
└───── hoge
|
49
|
+
```
|
50
|
+
|
51
|
+
`class` option
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
tree = MethodCallTree.create(class: true) do
|
55
|
+
Foo.new.foo
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
result
|
60
|
+
|
44
61
|
```
|
45
62
|
Foo::foo
|
46
63
|
├───── Foo::bar
|
@@ -48,10 +65,13 @@ Foo::foo
|
|
48
65
|
└───── Foo::hoge
|
49
66
|
```
|
50
67
|
|
68
|
+
---
|
69
|
+
|
51
70
|
`args` options enable
|
52
71
|
|
53
72
|
```ruby
|
54
73
|
require 'method_call_tree'
|
74
|
+
|
55
75
|
def fibonacci(a = 1, b = 0)
|
56
76
|
return if a > 10
|
57
77
|
fibonacci(a + b, a)
|
@@ -67,13 +87,13 @@ puts tree
|
|
67
87
|
result
|
68
88
|
|
69
89
|
```
|
70
|
-
|
71
|
-
└─────
|
72
|
-
└─────
|
73
|
-
└─────
|
74
|
-
└─────
|
75
|
-
└─────
|
76
|
-
└─────
|
90
|
+
fibonacci(a = 1, b = 0)
|
91
|
+
└───── fibonacci(a = 1, b = 1)
|
92
|
+
└───── fibonacci(a = 2, b = 1)
|
93
|
+
└───── fibonacci(a = 3, b = 2)
|
94
|
+
└───── fibonacci(a = 5, b = 3)
|
95
|
+
└───── fibonacci(a = 8, b = 5)
|
96
|
+
└───── fibonacci(a = 13, b = 8)
|
77
97
|
```
|
78
98
|
|
79
99
|
## License
|
data/lib/method_call_tree.rb
CHANGED
@@ -18,6 +18,7 @@ class MethodCallTree
|
|
18
18
|
|
19
19
|
def initialize(options)
|
20
20
|
@args = options[:args]
|
21
|
+
@class = options[:class]
|
21
22
|
@tree = {}
|
22
23
|
@queue = []
|
23
24
|
|
@@ -41,7 +42,9 @@ class MethodCallTree
|
|
41
42
|
TracePoint.new(:call, :return) do |tp|
|
42
43
|
case tp.event
|
43
44
|
when :call
|
44
|
-
key =
|
45
|
+
key = ''
|
46
|
+
key += "#{tp.defined_class}::" if @class
|
47
|
+
key += "#{tp.method_id}"
|
45
48
|
key += "(#{tp.binding.eval(GET_ARGUMENTS)})" if @args
|
46
49
|
key += "_#{id}"
|
47
50
|
id += 1
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|