posthog-ruby 3.32.0 → 3.32.2
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/lib/posthog/exception_capture.rb +20 -1
- data/lib/posthog/feature_flags.rb +26 -2
- data/lib/posthog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3056f1b2b68fc770ad5d18e659f34d6d992baaee102184e0f4a6d8b7fae3758c
|
|
4
|
+
data.tar.gz: 102c9721a7e7a99616948dbcd9486e4e6931d10eea192eff9c69f7cf7468416f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04d40769af7139d68a82052011107f43467aab48472b2747b1bb770c6e83f77404cdea25c718ec0db518cbdabd17e40fca96af7ca7e39c750fd9fc2f6e150efa
|
|
7
|
+
data.tar.gz: 2e9ef0c1931fda12ca37059632dd8d6e30eb889b9982c542e685b1846e1555daa26b638947daa0c7defb5ee1ebf0508d8d673b099ccbe37d5cba6c51a035d84f
|
|
@@ -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/...`).
|
|
@@ -548,9 +548,9 @@ module PostHog
|
|
|
548
548
|
when 'w'
|
|
549
549
|
parsed_dt = parsed_dt.prev_day(number * 7)
|
|
550
550
|
when 'm'
|
|
551
|
-
parsed_dt = parsed_dt
|
|
551
|
+
parsed_dt = subtract_months(parsed_dt, number)
|
|
552
552
|
when 'y'
|
|
553
|
-
parsed_dt = parsed_dt
|
|
553
|
+
parsed_dt = subtract_years(parsed_dt, number)
|
|
554
554
|
else
|
|
555
555
|
return nil
|
|
556
556
|
end
|
|
@@ -558,6 +558,30 @@ module PostHog
|
|
|
558
558
|
parsed_dt
|
|
559
559
|
end
|
|
560
560
|
|
|
561
|
+
# Steps back one month at a time and clamps the day after every step, as the
|
|
562
|
+
# SDK spec requires: March 31 minus two months is January 28. A single
|
|
563
|
+
# prev_month(2) clamps once and lands on January 31.
|
|
564
|
+
def self.subtract_months(date_time, months)
|
|
565
|
+
steps = 0
|
|
566
|
+
# Every month has at least 28 days, so once the day is 28 or less no step
|
|
567
|
+
# can clamp it again and the rest can be done in one jump.
|
|
568
|
+
while steps < months && date_time.day > 28
|
|
569
|
+
date_time = date_time.prev_month
|
|
570
|
+
steps += 1
|
|
571
|
+
end
|
|
572
|
+
date_time.prev_month(months - steps)
|
|
573
|
+
end
|
|
574
|
+
private_class_method :subtract_months
|
|
575
|
+
|
|
576
|
+
# Years work the same way. Only February 29 can clamp, and only on the first
|
|
577
|
+
# step, so one step followed by a single jump matches stepping every year.
|
|
578
|
+
def self.subtract_years(date_time, years)
|
|
579
|
+
return date_time if years.zero?
|
|
580
|
+
|
|
581
|
+
date_time.prev_year.prev_year(years - 1)
|
|
582
|
+
end
|
|
583
|
+
private_class_method :subtract_years
|
|
584
|
+
|
|
561
585
|
# Parse a single semver numeric identifier, rejecting empty, non-digit, or
|
|
562
586
|
# leading-zero values per semver 2.0.0 §2. `reason` names the owner of the value:
|
|
563
587
|
# UNSUPPORTED_DEFINITION for a filter value, MISSING_CONTEXT for a value the call passed.
|
data/lib/posthog/version.rb
CHANGED