trace_tree 0.2.10 → 0.2.11

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
  SHA1:
3
- metadata.gz: 8c319cfe698cc084bb69799aef2b56fdc3d026ac
4
- data.tar.gz: e2eedfdc873cd1b4dce0a352beb16ec3f5c00e8b
3
+ metadata.gz: b718ef2ac65f359114fe71dfb0fc137ae6aefb11
4
+ data.tar.gz: d2c1e1142e2f877ac500915a92400f968a3b7eda
5
5
  SHA512:
6
- metadata.gz: b7b9db24f2a3355146fdda2da93b4f086bb3b141c5bde8d7c8da329ba540412c04a33bef95d6feb71ef7767ad9a7b3a7fe59a57def1140a760c47a386119e2ad
7
- data.tar.gz: 9ff9e96ca80940f2f137986267437910264171cf0a5709dd962e053793c21974ed0ce8762f2bac6c3ae2d561d14a0fbdbfbcb338fe585427e6c78703eb3a2b11
6
+ metadata.gz: 0efbac5f49d16b1cff0b07818f81aee2c401c0997ad0939e3bca281d7fff3bffa3109a332bf114773a8e0bd7d8eed18c48a3b8425f7921613f645f9c234b73be
7
+ data.tar.gz: d5748c338201b73c875d901904e1bca2ee6c41ef4859bad477bac85c841242078b0069607ff4e353f6f07c3a0856490af7b3b7da3ba057688bc51099799c8356
data/README.md CHANGED
@@ -52,7 +52,7 @@ end
52
52
  * `:html => nil` by default. Set it true to generate a html in which a tree constructed with `<ul>`, `<li>`. (No need to set `color`).
53
53
  * `:tmp => nil` by default. Set it true or a string or an array of string to specify a tmp file under the default tmp dir of your system. (No need to provide `file` argument. It makes parent directories as needed)
54
54
  * `:htmp => nil` by default. It is combination of `:html` and `:tmp`.
55
- * `:return => true` by default. It puts return values of functions into html.
55
+ * `:return => true` by default. It stores return values of functions in generated html. Hover function call and press `r` to print return value in console.
56
56
  * `:args => false` by default. Set it true to puts arguments of `:call` functions into html. Since arguments are always return values of other functions, so this option is not necessary.
57
57
  * `:in => //, :out => nil` by default. Give them regexp(s) to include/exclude methods defined in files match that regexp(s). Notice thread-calls and methods defined by `define_method` are always included. Also, once you set any of these two options, the code to trace should not be in same line with `binding.trace_tree() do`.
58
58
  * `:timer => nil` by default. Set it true if you want to know how much time spent in tracing and drawing tree. Notice the `file` should be appendable, otherwise the time will overwrite the tree.
@@ -68,7 +68,7 @@ Try to remove a non-existing index:
68
68
  ArgumentError: Index name 'index_cars_on_online_at' on table 'cars' does not exist
69
69
  ```
70
70
 
71
- Then find the result HTML in tmp dir. Move your mouse on any method name, and press `f`/`u` to fold/unfold it's callee, press `p`/`n` to jump to it's previous/next sibling call, press `r` to print return value in scalable footer.
71
+ Then find the result HTML in tmp dir. Move your mouse on any method name, and press `f`/`u` to fold/unfold it's callee, press `p`/`n` to jump to it's previous/next sibling call, press `r` to print return value in console.
72
72
 
73
73
  ![image](https://user-images.githubusercontent.com/6105214/35904349-bf264ae4-0c1d-11e8-8ab4-0c256e4b014a.png)
74
74
 
@@ -0,0 +1,7 @@
1
+ (function(){
2
+ TreeHtml.hover_press('r', function(n){
3
+ var a = n.querySelector('a');
4
+ var repl = '> ' + a.querySelector('span').innerText + "\n" + a.getAttribute('data-return');
5
+ console.log(repl);
6
+ });
7
+ })();
@@ -3,11 +3,6 @@ require 'pp'
3
3
 
4
4
  class TraceTree
5
5
  module ReturnValue
6
-
7
- CONSOLE_JS = File.read File.expand_path('../console.js', __FILE__)
8
-
9
- CONSOLE_CSS = File.read File.expand_path('../console.css', __FILE__)
10
-
11
6
  BLANK = ''.freeze
12
7
 
13
8
  NEED_PP = (
@@ -23,14 +18,6 @@ class TraceTree
23
18
  super.merge!({return: attr_value})
24
19
  end
25
20
 
26
- def css_for_tree_html
27
- super + CONSOLE_CSS
28
- end
29
-
30
- def body_js_for_tree_html
31
- super.push({text: CONSOLE_JS})
32
- end
33
-
34
21
  def self.formatted klass, &block
35
22
  klass.send :define_method, :_trace_tree_pp, &block
36
23
  end
@@ -64,4 +51,29 @@ class TraceTree
64
51
  end
65
52
 
66
53
  end
54
+
55
+ module ConsoleReturnValue
56
+ include ReturnValue
57
+
58
+ JS = File.read File.expand_path('../native_console.js', __FILE__)
59
+
60
+ def body_js_for_tree_html
61
+ super.push({text: JS})
62
+ end
63
+ end
64
+
65
+ module LuxuryReturnValue
66
+ include ReturnValue
67
+
68
+ JS = File.read File.expand_path('../console.js', __FILE__)
69
+ CSS = File.read File.expand_path('../console.css', __FILE__)
70
+
71
+ def css_for_tree_html
72
+ super + CSS
73
+ end
74
+
75
+ def body_js_for_tree_html
76
+ super.push({text: JS})
77
+ end
78
+ end
67
79
  end
@@ -1,3 +1,3 @@
1
1
  class TraceTree
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
data/lib/trace_tree.rb CHANGED
@@ -71,7 +71,11 @@ class TraceTree
71
71
  enhancement = []
72
72
  enhancement << TraceTree::Color unless opt[:color] == false
73
73
  enhancement << TraceTree::ShortGemPath unless opt[:gem] == false
74
- enhancement << TraceTree::ReturnValue unless opt[:return] == false
74
+ if opt[:return].nil? || opt[:return] == true
75
+ enhancement << TraceTree::ConsoleReturnValue
76
+ elsif opt[:return] == :lux
77
+ enhancement << TraceTree::LuxuryReturnValue
78
+ end
75
79
  enhancement << TraceTree::Args if opt[:args] == true
76
80
  @point_loader = Point::Loader.new *enhancement, config
77
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trace_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-07 00:00:00.000000000 Z
11
+ date: 2018-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,6 +147,7 @@ files:
147
147
  - lib/trace_tree/console.css
148
148
  - lib/trace_tree/console.js
149
149
  - lib/trace_tree/gem_paths.rb
150
+ - lib/trace_tree/native_console.js
150
151
  - lib/trace_tree/point.rb
151
152
  - lib/trace_tree/point/call_activesupportconcern_appendfeatures.rb
152
153
  - lib/trace_tree/point/call_modulemutexm_extendobject.rb