tracia 0.2.2 → 0.2.5

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: 3cb9b65fa0d3c36e530bdf201281a35c6f58d38273e2287b12d80688b2cc0a8a
4
- data.tar.gz: b61d048ac0eb2f09cc432e2ca4aaa0035e4a1ab2d7e6d18b848cdce1d97b67a4
3
+ metadata.gz: 1749c13c95b1ecd54e9b6e812bea86021d95960e1d6b07f093a748fc594bc440
4
+ data.tar.gz: c4bec7a75c6c67e8fc683c475444b902e18bac414730d80a142f8448b1cbe3da
5
5
  SHA512:
6
- metadata.gz: 5432ae3e05b76ca7fe8c90ef02843669e627e6aae92e42c257285f37cdcaa03215badbf9b2ad86cac9dc0462cef6a8e60190434de79612028fade99edb6c894b
7
- data.tar.gz: c41e5de84fc6aba18dcecbadd856c4715f2ffd8ffdcfbc1cc93ffcd35956003f0d4948e313eb93621101395f50e54b26c7ebf41c394bf632a47ba63d77922491
6
+ metadata.gz: 7b05410f5cc503504f15daf3fd4dbc833c47677be0032eb9355dd7cd7f4af6ae1d24a292d587afb128ddd6952b17fc2c3012c1adb5ce65efbdd326d911aaa67d
7
+ data.tar.gz: 4a8492aed4a2e71165e7c7e2bf11ecda59d93cac7fb174175364d6969cfd09add1aa98bcbc6619b78a5fcfac984fb82167081f4df50e2f2b0e8df53157e31b0b
@@ -1,25 +1,13 @@
1
1
  class Tracia
2
2
  class DefaultLogger
3
- NO_CHILD = []
4
-
5
- class << self
6
- def tree_graph_everything!
7
- Object.define_method(:label_for_tree_graph) do
8
- to_s
9
- end
10
-
11
- Object.define_method(:children_for_tree_graph) do
12
- NO_CHILD
13
- end
14
- end
15
- end
16
-
17
- def initialize(out: STDOUT)
3
+ def initialize(out: STDOUT, html: false)
18
4
  @out = out
5
+ @html = html
19
6
  end
20
7
 
21
8
  def call(root)
22
- @out.puts root.tree_graph
9
+ content = @html ? root.tree_html_full : root.tree_graph
10
+ @out.puts content
23
11
  end
24
12
  end
25
13
  end
data/lib/tracia/frame.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  require "tree_graph"
2
+ require "tree_html"
3
+ require "cgi"
2
4
 
3
5
  class Tracia
4
6
  class Frame
5
7
  include TreeGraph
8
+ include TreeHtml
6
9
 
7
- attr_reader :klass, :call_sym, :method_name, :children, :file
10
+ attr_reader :klass, :call_sym, :method_name, :children, :file, :lineno
8
11
 
9
12
  def initialize(klass, call_sym, method_name, file, lineno)
10
13
  @klass = klass
@@ -22,11 +25,33 @@ class Tracia
22
25
  end
23
26
 
24
27
  def label_for_tree_graph
25
- "#{klass}#{call_sym}#{method_name} #{GemPaths.shorten(@file)}:#{@lineno}"
28
+ "#{class_and_method} #{source_location}"
26
29
  end
27
30
 
28
31
  def children_for_tree_graph
29
32
  children
30
33
  end
34
+
35
+ def label_for_tree_html
36
+ "<span class='hl'>#{CGI::escapeHTML(class_and_method)}</span> #{CGI::escapeHTML(source_location)}"
37
+ end
38
+
39
+ def children_for_tree_html
40
+ children
41
+ end
42
+
43
+ def css_for_tree_html
44
+ '.hl{color: #a50000;}'
45
+ end
46
+
47
+ private
48
+
49
+ def class_and_method
50
+ "#{klass}#{call_sym}#{method_name}"
51
+ end
52
+
53
+ def source_location
54
+ "#{GemPaths.shorten(@file)}:#{@lineno}"
55
+ end
31
56
  end
32
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Tracia
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-15 00:00:00.000000000 Z
11
+ date: 2022-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -30,14 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.2
33
+ version: 0.2.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.2
40
+ version: 0.2.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: tree_html
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.8
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.8
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: binding_of_callers
43
57
  requirement: !ruby/object:Gem::Requirement