rails_tracepoint_stack 0.1.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rails_tracepoint_stack.rb +18 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c2142c424856432fcbffe301fe9373267e48903dedf46eceee369762e86e39d7
4
+ data.tar.gz: 3f25f8c76e7247d0971c6bff5580ca3507d322616ae7df56c6193e844badb786
5
+ SHA512:
6
+ metadata.gz: 37545fe7d2b1975484566260a4673bd122475fd4e10fb0e8b6012822bf00c5a8947f46c0c24e767a0c3a8d565eb2c26f32dd1525d742c40bf7db8911df612e01
7
+ data.tar.gz: cf08ca7c235c7909e1d2830cbe6d7126ba4d3f856b4c53003ef8925f2678f5eafc4672b238fc6db6e63c41fba3e1d484da4f99511aea0cf2abbaa01051d11420
@@ -0,0 +1,18 @@
1
+ gem_paths = Bundler.load.specs.map(&:full_gem_path)
2
+ ruby_lib_path = RbConfig::CONFIG['rubylibdir']
3
+
4
+ trace = TracePoint.new(:call) do |tp|
5
+ next if tp.path.start_with?('<internal:') || tp.path == '(eval)' || gem_paths.any? { |path| tp.path.start_with?(path) } || tp.path.start_with?(ruby_lib_path)
6
+
7
+ params = tp.binding.local_variables.map { |var|
8
+ [var, tp.binding.local_variable_get(var)]
9
+ }.to_h
10
+
11
+ puts "called: #{tp.defined_class}##{tp.method_id} in #{tp.path}:#{tp.lineno} with params: #{params}"
12
+ end
13
+
14
+ trace.enable
15
+
16
+ at_exit do
17
+ trace.disable
18
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_tracepoint_stack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Daniel Pohlod
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A formatted output of all methods called in your rails application of
14
+ code created by the developer, with the complete path to the class/module, including
15
+ passed params.
16
+ email: carlospohlod@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/rails_tracepoint_stack.rb
22
+ homepage: https://rubygems.org/gems/rails_tracepoint_stack
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.4.10
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Get a complete stack trace for Rails code calls
45
+ test_files: []