tracia 0.2.4 → 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: bd11b2221dbdd8fe58cc1ff87b096fa4df1cb6731cafddfef9d17ada8a2a812c
4
- data.tar.gz: 4f37c6bd988831d7f672fa91607e4de4216a7661e4317e514322e80b80f56c95
3
+ metadata.gz: 1749c13c95b1ecd54e9b6e812bea86021d95960e1d6b07f093a748fc594bc440
4
+ data.tar.gz: c4bec7a75c6c67e8fc683c475444b902e18bac414730d80a142f8448b1cbe3da
5
5
  SHA512:
6
- metadata.gz: 9c41f9213fd72b995f4a1ff06e2881354835f173c7af6e95d70a7fcd2a67d1fa382819d9823edc8fe20429e9e7b97fe46878be06858521fe7f167b49d7d06270
7
- data.tar.gz: 272914638a974b686fc85e359215b2117be14c4807a5bd58c036325c301822dd457f2fb9e99484308021e426e49b81883036903abd5febafcab1d491bd2506d8
6
+ metadata.gz: 7b05410f5cc503504f15daf3fd4dbc833c47677be0032eb9355dd7cd7f4af6ae1d24a292d587afb128ddd6952b17fc2c3012c1adb5ce65efbdd326d911aaa67d
7
+ data.tar.gz: 4a8492aed4a2e71165e7c7e2bf11ecda59d93cac7fb174175364d6969cfd09add1aa98bcbc6619b78a5fcfac984fb82167081f4df50e2f2b0e8df53157e31b0b
@@ -1,11 +1,13 @@
1
1
  class Tracia
2
2
  class DefaultLogger
3
- def initialize(out: STDOUT)
3
+ def initialize(out: STDOUT, html: false)
4
4
  @out = out
5
+ @html = html
5
6
  end
6
7
 
7
8
  def call(root)
8
- @out.puts root.tree_graph
9
+ content = @html ? root.tree_html_full : root.tree_graph
10
+ @out.puts content
9
11
  end
10
12
  end
11
13
  end
data/lib/tracia/frame.rb CHANGED
@@ -1,8 +1,11 @@
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
10
  attr_reader :klass, :call_sym, :method_name, :children, :file, :lineno
8
11
 
@@ -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.4"
4
+ VERSION = "0.2.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
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