dev_suite 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dev_suite/method_tracer/logger.rb +4 -9
- data/lib/dev_suite/method_tracer/tracer.rb +14 -6
- data/lib/dev_suite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c4f76e1bde363b53c6e0e76616ce4589f37e17af746b6e1d77019aa0d2c58d9
|
4
|
+
data.tar.gz: b93fd9c938777e4c5c366b34b761b38d5e3bfb38231b345b125f41f5655576ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8c153fb7c5fa8f73a03e1ae33cc8fbc71b825150c557dad9d0f2bc9e2a1b3e8054b7d334b02bfe51cb4e72c10d13732bbb0247be3c5235ece0c639338aa370e
|
7
|
+
data.tar.gz: f42462a700acc328deca1071c7a9cccd63c93eba44928c3510707afe4173b7ea6c478328103d47abfe30ce86d2e7430d120ecc5c3a46fa95f3e9355d5b27c377
|
data/Gemfile.lock
CHANGED
@@ -5,8 +5,6 @@ module DevSuite
|
|
5
5
|
module Logger
|
6
6
|
class << self
|
7
7
|
def log_method_call(tp, tracer)
|
8
|
-
tracer.depth += 1
|
9
|
-
|
10
8
|
# Store the start time for execution time calculation
|
11
9
|
tracer.start_times[tp.method_id] = Time.now
|
12
10
|
|
@@ -19,9 +17,6 @@ module DevSuite
|
|
19
17
|
|
20
18
|
message = build_return_message(tp, tracer, duration)
|
21
19
|
Utils::Logger.log(message, emoji: :finish, color: :cyan)
|
22
|
-
|
23
|
-
# Decrement depth safely
|
24
|
-
tracer.depth = [tracer.depth - 1, 0].max
|
25
20
|
end
|
26
21
|
|
27
22
|
private
|
@@ -34,8 +29,8 @@ module DevSuite
|
|
34
29
|
def build_call_message(tp, tracer)
|
35
30
|
method_name = colorize_text(Helpers.format_method_name(tp), :blue)
|
36
31
|
params_str = tracer.show_params ? colorize_text(Helpers.format_params(tp), :yellow) : ""
|
37
|
-
indent = Helpers.calculate_indent(tracer.
|
38
|
-
depth_str = colorize_text("#depth:#{tracer.
|
32
|
+
indent = Helpers.calculate_indent(tracer.current_depth)
|
33
|
+
depth_str = colorize_text("#depth:#{tracer.current_depth}", :magenta)
|
39
34
|
|
40
35
|
"#{indent}#{depth_str} > #{method_name} at #{tp.path}:#{tp.lineno} #{params_str}"
|
41
36
|
end
|
@@ -57,8 +52,8 @@ module DevSuite
|
|
57
52
|
else
|
58
53
|
""
|
59
54
|
end
|
60
|
-
indent = Helpers.calculate_indent(tracer.
|
61
|
-
depth_str = colorize_text("#depth:#{tracer.
|
55
|
+
indent = Helpers.calculate_indent(tracer.current_depth)
|
56
|
+
depth_str = colorize_text("#depth:#{tracer.current_depth}", :magenta)
|
62
57
|
|
63
58
|
"#{indent}#{depth_str} < #{method_name}#{result_str} at #{tp.path}:#{tp.lineno}#{exec_time_str}"
|
64
59
|
end
|
@@ -4,7 +4,7 @@ module DevSuite
|
|
4
4
|
module MethodTracer
|
5
5
|
class Tracer
|
6
6
|
attr_reader :show_params, :show_results, :show_execution_time, :max_depth
|
7
|
-
attr_accessor :
|
7
|
+
attr_accessor :current_depth, :trace_point, :start_times
|
8
8
|
|
9
9
|
def initialize(
|
10
10
|
show_params: false,
|
@@ -16,8 +16,8 @@ module DevSuite
|
|
16
16
|
@show_results = show_results
|
17
17
|
@show_execution_time = show_execution_time
|
18
18
|
@max_depth = max_depth
|
19
|
-
@depth = 0
|
20
19
|
@start_times = {}
|
20
|
+
@current_depth = 0
|
21
21
|
end
|
22
22
|
|
23
23
|
def trace(&block)
|
@@ -50,15 +50,23 @@ module DevSuite
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def handle_call_event(tp)
|
53
|
-
|
53
|
+
@current_depth += 1
|
54
|
+
|
55
|
+
if current_depth_within_limit?
|
56
|
+
Logger.log_method_call(tp, self)
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
def handle_return_event(tp)
|
57
|
-
|
61
|
+
if current_depth_within_limit?
|
62
|
+
Logger.log_method_return(tp, self)
|
63
|
+
end
|
64
|
+
|
65
|
+
@current_depth -= 1
|
58
66
|
end
|
59
67
|
|
60
|
-
def
|
61
|
-
max_depth.nil? ||
|
68
|
+
def current_depth_within_limit?
|
69
|
+
max_depth.nil? || current_depth <= max_depth
|
62
70
|
end
|
63
71
|
end
|
64
72
|
end
|
data/lib/dev_suite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev_suite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huy Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark
|