posthog-ruby 3.32.0 → 3.32.1

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: 025cc00787e8fc35ab922fe03e64409937cb1a4fa1ae6c7bf9189e7464d278db
4
- data.tar.gz: bb052d99ca78a5112cf01575fc93ccca51366ad007226ccccfc186007aa4e3b6
3
+ metadata.gz: 6f3617315bd23ae3b6cbce6213b21cbc10cb83db1dfc6a0c111d5f94404088cc
4
+ data.tar.gz: 47b81c9ce5aef958562908d9687d7ef95d89ae675692f3e8f3f1583857298959
5
5
  SHA512:
6
- metadata.gz: 5ca10f382fe03e35018980520b20fffc322543ee125ff241cbda55f39d505780466983f0e3ff7b7064a0e45202d0b414a97a31d4fb211b383d6b63397f61539d
7
- data.tar.gz: 0f81d05df9dfb75672227b7c1f841256fcc198eba2c7f35a9e26d89a654092fc48d697d4f9ceaea94c222320983bfc0c0da5d2402a47ba94de41143a95b482e5
6
+ metadata.gz: 493420b17402e4d2bbdd0cbc9dea605cd23921f07b89e15e5c048c724a184b86f3c1b43c6989b60e9875801fd598c264523ed46d8a5a1710af53dacbef5c52e2
7
+ data.tar.gz: 6a9efff5883c666fcb1df41163eee04af68f1b5c69e03c551b262d0fec0fbede69fdc3f5f0af703f72043b5e259c214535b72d1ebaefaeb015f1202aeb29c7cf
@@ -119,7 +119,7 @@ module PostHog
119
119
 
120
120
  file = match[1]
121
121
  lineno = match[2].to_i
122
- method_name = match[5]
122
+ method_name = normalize_rails_template_method(match[5], file)
123
123
 
124
124
  frame = {
125
125
  'filename' => frame_filename(file, project_root),
@@ -135,6 +135,25 @@ module PostHog
135
135
  frame
136
136
  end
137
137
 
138
+ def self.normalize_rails_template_method(method_name, file)
139
+ return method_name unless defined?(::Rails) && method_name
140
+
141
+ return method_name unless method_name.match?(/___?\d+__?\d+\z/)
142
+
143
+ # Action View encodes the template identifier, then appends its hash and
144
+ # object ID, replacing minus signs with underscores. Its short identifier
145
+ # strips "/" when Rails.root is nil, unlike the project_root fallback.
146
+ relative_path = defined?(::Rails.root) ? file.delete_prefix("#{::Rails.root}/") : file
147
+ [file, relative_path].uniq.each do |path|
148
+ identifier = Regexp.escape("_#{path.tr('^a-z_', '_')}")
149
+ normalized = method_name.sub(/(\A(?:block(?: \(\d+ levels\))? in )?#{identifier})___?\d+__?\d+\z/, '\1')
150
+ return normalized unless normalized == method_name
151
+ end
152
+
153
+ method_name
154
+ end
155
+ private_class_method :normalize_rails_template_method
156
+
138
157
  # Root directory the application runs from, used to derive stable
139
158
  # project-relative filenames from per-host deploy paths
140
159
  # (e.g. `/app/releases/20240101/...`).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostHog
4
- VERSION = '3.32.0'
4
+ VERSION = '3.32.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posthog-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.32.0
4
+ version: 3.32.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''