trace_location 0.11.0 → 0.12.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: 010e65cd3a2447cb0816fd31bb62eec1acb6546a0cc2d8667df523027d24abd4
4
- data.tar.gz: 9bce85eda13a6836c0195d05265dcaf9794d4f2356d6a0b5ad5cf25d915db5b9
3
+ metadata.gz: 0f72080e074e711ead889178f5bf03db6f01b2d1f2baee4c7a0017c8e1b374e2
4
+ data.tar.gz: 83d066fd0c05fd30488ab17a213d2e6cc871a6b2274e155dd3ee87f2c12cf7a6
5
5
  SHA512:
6
- metadata.gz: 274ae1e802b7eb65e81cabd20fc66bd7b8ba2c7427e6eb2e5e6dee0a9415350a26cad2827f670151b9e94329b4702bca8086432b94179c20b15e48fca3a5265e
7
- data.tar.gz: 367ae84388dd7a5b331ed780b99e6539a9f895aa5be06acdde803501a1bef8f24c155b7334031d4dc6314272332511773dfe4139ac825c63c53df5dc346c6c91
6
+ metadata.gz: d5ea1a2a317eeddd8a02b6013150a8969db58738b724004775f99d4a284cfdc394d620a81bff79063cd07cf295f42f4be98d62b3150c62da83fed95b3f51e6dc
7
+ data.tar.gz: 9fae9ec4eb6e18de78ffec2e94718fd8eb7b3d3fb8f46964aecce96da4fedfc5efe161d2ce2f514a201e0cb556b3e2759e1f7136a0c9c0b9ef655419e4bedd2a
data/.travis.yml CHANGED
@@ -3,8 +3,8 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.6.6
7
- - 2.7.1
6
+ - 2.6.7
7
+ - 2.7.3
8
8
  - ruby-head
9
9
  before_install: gem install bundler -v 2.1.4
10
10
 
data/Gemfile.lock CHANGED
@@ -1,43 +1,50 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trace_location (0.11.0)
4
+ trace_location (0.12.0)
5
5
  method_source
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.0)
11
- diff-lcs (1.3)
12
- jaro_winkler (1.5.2)
10
+ ast (2.4.2)
11
+ diff-lcs (1.5.0)
12
+ json (2.6.3)
13
13
  method_source (1.0.0)
14
- parallel (1.17.0)
15
- parser (2.6.3.0)
16
- ast (~> 2.4.0)
17
- rainbow (3.0.0)
18
- rake (13.0.1)
19
- rspec (3.8.0)
20
- rspec-core (~> 3.8.0)
21
- rspec-expectations (~> 3.8.0)
22
- rspec-mocks (~> 3.8.0)
23
- rspec-core (3.8.0)
24
- rspec-support (~> 3.8.0)
25
- rspec-expectations (3.8.3)
14
+ parallel (1.22.1)
15
+ parser (3.1.3.0)
16
+ ast (~> 2.4.1)
17
+ rainbow (3.1.1)
18
+ rake (13.0.6)
19
+ regexp_parser (2.6.1)
20
+ rexml (3.2.5)
21
+ rspec (3.12.0)
22
+ rspec-core (~> 3.12.0)
23
+ rspec-expectations (~> 3.12.0)
24
+ rspec-mocks (~> 3.12.0)
25
+ rspec-core (3.12.0)
26
+ rspec-support (~> 3.12.0)
27
+ rspec-expectations (3.12.0)
26
28
  diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.8.0)
28
- rspec-mocks (3.8.0)
29
+ rspec-support (~> 3.12.0)
30
+ rspec-mocks (3.12.1)
29
31
  diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.8.0)
31
- rspec-support (3.8.0)
32
- rubocop (0.71.0)
33
- jaro_winkler (~> 1.5.1)
32
+ rspec-support (~> 3.12.0)
33
+ rspec-support (3.12.0)
34
+ rubocop (1.40.0)
35
+ json (~> 2.3)
34
36
  parallel (~> 1.10)
35
- parser (>= 2.6)
37
+ parser (>= 3.1.2.1)
36
38
  rainbow (>= 2.2.2, < 4.0)
39
+ regexp_parser (>= 1.8, < 3.0)
40
+ rexml (>= 3.2.5, < 4.0)
41
+ rubocop-ast (>= 1.23.0, < 2.0)
37
42
  ruby-progressbar (~> 1.7)
38
- unicode-display_width (>= 1.4.0, < 1.7)
39
- ruby-progressbar (1.10.1)
40
- unicode-display_width (1.6.0)
43
+ unicode-display_width (>= 1.4.0, < 3.0)
44
+ rubocop-ast (1.24.0)
45
+ parser (>= 3.1.1.0)
46
+ ruby-progressbar (1.11.0)
47
+ unicode-display_width (2.3.0)
41
48
 
42
49
  PLATFORMS
43
50
  ruby
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/yhirano55/trace_location.svg?branch=master)](https://travis-ci.org/yhirano55/trace_location)
4
4
 
5
- TraceLocation helps you get tracing the source location of codes, and helps you can get reading the huge open souce libraries in Ruby.
5
+ TraceLocation helps you trace the source location to ease reading huge open-source libraries in Ruby.
6
6
 
7
7
  ## Installation
8
8
 
@@ -42,6 +42,7 @@ Then you can get logs like this: [.md](https://github.com/yhirano55/trace_locati
42
42
  | format | `:md`, `:log`, `:csv` (default: `:md`) | `:md` |
43
43
  | match | Regexp, Symbol, String or Array for allow list | `[:activerecord, :activesupport]` |
44
44
  | ignore | Regexp, Symbol, String or Array for deny list | `/bootsnap\|activesupport/` |
45
+ | methods | Symbol or Array of method names | `[:call]` |
45
46
 
46
47
  ## More examples
47
48
 
@@ -8,7 +8,8 @@ module TraceLocation
8
8
  Result = Struct.new(:events, :return_value)
9
9
 
10
10
  class << self
11
- def collect(match:, ignore:, &block)
11
+ def collect(match:, ignore:, methods:, &block)
12
+ methods = Array(methods) if methods
12
13
  events = []
13
14
  hierarchy = 0
14
15
  id = 0
@@ -18,6 +19,7 @@ module TraceLocation
18
19
  tracer = TracePoint.new(:call, :return) do |trace_point|
19
20
  next if match && !trace_point.path.to_s.match?(/#{Array(match).join('|')}/)
20
21
  next if ignore && trace_point.path.to_s.match?(/#{Array(ignore).join('|')}/)
22
+ next if methods && !methods.include?(trace_point.method_id)
21
23
 
22
24
  id += 1
23
25
  caller_loc = caller_locations(2, 1)[0]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TraceLocation
4
- VERSION = '0.11.0'
4
+ VERSION = '0.12.0'
5
5
  end
@@ -16,8 +16,9 @@ module TraceLocation # :nodoc:
16
16
  def self.trace(options = {}, &block)
17
17
  match = options.delete(:match)
18
18
  ignore = options.delete(:ignore)
19
+ methods = options.delete(:methods)
19
20
 
20
- result = Collector.collect(match: match, ignore: ignore, &block)
21
+ result = Collector.collect(match: match, ignore: ignore, methods: methods, &block)
21
22
  Report.build(result.events, result.return_value, options).generate
22
23
  true
23
24
  rescue StandardError => e
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trace_location
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshiyuki Hirano
8
8
  - Misaki Shioi
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-08-12 00:00:00.000000000 Z
12
+ date: 2022-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: method_source
@@ -122,7 +122,7 @@ homepage: https://github.com/yhirano55/trace_location
122
122
  licenses:
123
123
  - MIT
124
124
  metadata: {}
125
- post_install_message:
125
+ post_install_message:
126
126
  rdoc_options: []
127
127
  require_paths:
128
128
  - lib
@@ -137,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 3.1.2
141
- signing_key:
140
+ rubygems_version: 3.3.26
141
+ signing_key:
142
142
  specification_version: 4
143
143
  summary: helps you get tracing the source location of codes
144
144
  test_files: []