traceologist 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c261c58ea4419254a9430d2ebabfda66ebf2ad5e8d9db9f95f3ec31d7563a26e
4
- data.tar.gz: cd77fd9073de348dcec9306a3f51d1c84465e98c33dd192c30ff8bc06373a949
3
+ metadata.gz: 4adb6bbde552ca8fd7a4190bb6e10176a5b4811c43576674f42572c01875fc6f
4
+ data.tar.gz: 641956783b73b1a1f9d9f0e138a6e84dd05341cd751db9d8dad30b9ac5430a24
5
5
  SHA512:
6
- metadata.gz: 3a5e166470e5df3db44bb7429d53fecc306a2058be77659129df6693108ef230ab5527cd4c2488fc9f9fa596afdc000550ea0552530bf3eeda46f0f0698653b0
7
- data.tar.gz: 0ab1eeb6feede252012c4b5eb8c606b3f688f5e33d8f474881cd9cb57ae44b7970bf8631007e842edebe551ef8ea59c9591250e1adcc11a797a21d665742832d
6
+ metadata.gz: 492a2cd1569bda726ee3eb9cc42bcd47915d6cc64488815765465888006fbf65d6707b3cc324f79886720ce22ce7fd73e045668dfadc8baf8ffa549a35bf0401
7
+ data.tar.gz: 78caa58b53a7cb131cb68572208231c33e9f7bd314d7c73b07b98528e963410c56e5f8219fb1ac61b22362bf2a2fbb53c419f16c7066243a30b21a333b6a3ece
data/README.md CHANGED
@@ -74,10 +74,10 @@ Without a filter, **all** Ruby method calls within the block are traced.
74
74
  Traceologist.trace_sequence(depth_limit: 5, filter: "MyClass") { ... }
75
75
  ```
76
76
 
77
- #### `show_location:` — Include source file and line number
77
+ #### `show_locations:` — Include source file and line number
78
78
 
79
79
  ```ruby
80
- result = Traceologist.trace_sequence(filter: "MyClass", show_location: true) do
80
+ result = Traceologist.trace_sequence(filter: "MyClass", show_locations: true) do
81
81
  MyClass.new.run
82
82
  end
83
83
  ```
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Traceologist
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/traceologist.rb CHANGED
@@ -23,23 +23,23 @@ module Traceologist
23
23
  # @param depth_limit [Integer] Maximum call depth to trace (default: 20)
24
24
  # @param filter [String, Symbol, Array<String, Symbol>, nil] Only trace classes whose name
25
25
  # starts with one of these prefixes. When nil, all calls are traced.
26
- # @param show_location [Boolean] Whether to include source file and line number (default: false)
26
+ # @param show_locations [Boolean] Whether to include source file and line number (default: false)
27
27
  # @yield The block of code to trace
28
28
  # @return [Traceologist::String] The call sequence as a newline-joined string
29
29
  #
30
30
  # @example
31
31
  # result = Traceologist.trace_sequence(filter: "MyClass") { MyClass.new.run }
32
32
  # puts result
33
- def self.trace_sequence(depth_limit: 20, filter: nil, show_location: false, &)
34
- Tracer.new(depth_limit: depth_limit, filter: filter, show_location: show_location).run(&)
33
+ def self.trace_sequence(depth_limit: 20, filter: nil, show_locations: false, &)
34
+ Tracer.new(depth_limit: depth_limit, filter: filter, show_locations: show_locations).run(&)
35
35
  end
36
36
 
37
37
  # @api private
38
38
  class Tracer
39
- def initialize(depth_limit:, filter:, show_location:)
39
+ def initialize(depth_limit:, filter:, show_locations:)
40
40
  @depth_limit = depth_limit
41
41
  @filter = filter
42
- @show_location = show_location
42
+ @show_locations = show_locations
43
43
  @depth = 0
44
44
  @call_stack = []
45
45
  @calls = []
@@ -86,7 +86,7 @@ module Traceologist
86
86
 
87
87
  def call_line(event)
88
88
  indent = " " * @depth
89
- location = @show_location ? " # #{event.path}:#{event.lineno}" : ""
89
+ location = @show_locations ? " # #{event.path}:#{event.lineno}" : ""
90
90
  "#{indent}-> #{label(event)}#{location}"
91
91
  end
92
92
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceologist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koji NAKAMURA