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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 484aa4c05a41bb984d586cbf8e5f620aaa1ea816fbff780df434027f574fc9a3
4
- data.tar.gz: 0bf6d62ebcfe2a9264d34b76d11915b3d162a47fa203e0e29bf960ff1624472d
3
+ metadata.gz: c6c0c624e60b8b0175434f4e97f84589b878d1d2df9a5bda88dd03287fc41b1e
4
+ data.tar.gz: be51e901388d2ec14fd5b0acaaf5f623764b6ec53eff6ffb20cef4662f7ca8d4
5
5
  SHA512:
6
- metadata.gz: 1bcac72e5de0ea7244f44c73c0dbc6d976c5122db0ed395f6468dc22f328f39da7bcc2faf0908eea99419086e20ef42841bf66871fb559e62959b4cb788be122
7
- data.tar.gz: 153746635ecbf35047ef88fd6e34e9720a17c96b71b6f1e7cd1b795dd6775eb21cd519d537102f703e1327171aaca53ee4816064e65101d39098337b55775167
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- method_call_tree (1.1.0)
4
+ method_call_tree (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- Object::fibonacci(a = 1, b = 0)
71
- └───── Object::fibonacci(a = 1, b = 1)
72
- └───── Object::fibonacci(a = 2, b = 1)
73
- └───── Object::fibonacci(a = 3, b = 2)
74
- └───── Object::fibonacci(a = 5, b = 3)
75
- └───── Object::fibonacci(a = 8, b = 5)
76
- └───── Object::fibonacci(a = 13, b = 8)
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
@@ -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 = "#{tp.defined_class}::#{tp.method_id}"
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
@@ -1,3 +1,3 @@
1
1
  class MethodCallTree
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: method_call_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuichi Tamayose
metadata.gz.sig CHANGED
Binary file