umbrellio-utils 0.7.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c059f42f8e519125db1cf5fe6e33c6aab0d58dd4a6089e95029b6c1df612cd7
4
- data.tar.gz: bc8c7022274fe2e591c3124cf848ea1ed904b130e6158805bcd44b684589723f
3
+ metadata.gz: e5415ce42c2ba64403bb051b4d1772724226f8f0eb321d7eacae22af3db9961e
4
+ data.tar.gz: 11f4a31ba535995db43fd3d5f8d180061d494488baf2a7548fa13844ee5b5b53
5
5
  SHA512:
6
- metadata.gz: 92d84410033f5c3dc353f3e65736185663a798c8d1dcd0dcd5430365f3396117e5e4766d1e1cde91bfa782f798d1f14ee3e7dc07f4e0d93eaf676a9221353c05
7
- data.tar.gz: 2266a02f0ac7f6c4525187d3aaa2162e201582e2eff1e93cf1ea2c3862e0475e2e47ff79e1891840b2efaa8f77f31c979b571deab8e9634f34d544c416da6f2f
6
+ metadata.gz: 715ccd8c42effe71b0be1e8482d8188b8dace23acd7e579b35d3491d4ba0c8d8d77b3e33396c22b034ea6f6199a0983b274828e05ab62ea684bc6ff57d74594b
7
+ data.tar.gz: d312202f931ee6d070f660f39148aaece7d71f5cca2a68ee31b61f4c5da525950b6702e0cd0f616e126047627aab9d6326641ed6310279c6ffa2e07cae536364
@@ -15,7 +15,7 @@ jobs:
15
15
  strategy:
16
16
  fail-fast: false
17
17
  matrix:
18
- ruby: ["2.7", "3.0", "3.1", "3.2"]
18
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
19
19
 
20
20
  services:
21
21
  postgres:
data/.rubocop.yml CHANGED
@@ -3,7 +3,8 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.7
6
+ TargetRubyVersion: 3.0
7
+ SuggestExtensions: false
7
8
 
8
9
  Naming/MethodParameterName:
9
10
  AllowedNames: ["x", "y", "z"]
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ group :development, :test do
10
10
  gem "bundler"
11
11
  gem "ci-helper"
12
12
  gem "http"
13
- gem "nokogiri"
13
+ gem "nokogiri", "~> 1.15.0"
14
14
  gem "nori"
15
15
  gem "pg"
16
16
  gem "pry"
data/Gemfile.lock CHANGED
@@ -1,125 +1,141 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- umbrellio-utils (0.7.5)
4
+ umbrellio-utils (1.0.0)
5
5
  memery (~> 1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.8)
11
- actionpack (= 7.0.8)
12
- activesupport (= 7.0.8)
10
+ actioncable (7.1.3.2)
11
+ actionpack (= 7.1.3.2)
12
+ activesupport (= 7.1.3.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.8)
16
- actionpack (= 7.0.8)
17
- activejob (= 7.0.8)
18
- activerecord (= 7.0.8)
19
- activestorage (= 7.0.8)
20
- activesupport (= 7.0.8)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (7.1.3.2)
17
+ actionpack (= 7.1.3.2)
18
+ activejob (= 7.1.3.2)
19
+ activerecord (= 7.1.3.2)
20
+ activestorage (= 7.1.3.2)
21
+ activesupport (= 7.1.3.2)
21
22
  mail (>= 2.7.1)
22
23
  net-imap
23
24
  net-pop
24
25
  net-smtp
25
- actionmailer (7.0.8)
26
- actionpack (= 7.0.8)
27
- actionview (= 7.0.8)
28
- activejob (= 7.0.8)
29
- activesupport (= 7.0.8)
26
+ actionmailer (7.1.3.2)
27
+ actionpack (= 7.1.3.2)
28
+ actionview (= 7.1.3.2)
29
+ activejob (= 7.1.3.2)
30
+ activesupport (= 7.1.3.2)
30
31
  mail (~> 2.5, >= 2.5.4)
31
32
  net-imap
32
33
  net-pop
33
34
  net-smtp
34
- rails-dom-testing (~> 2.0)
35
- actionpack (7.0.8)
36
- actionview (= 7.0.8)
37
- activesupport (= 7.0.8)
38
- rack (~> 2.0, >= 2.2.4)
35
+ rails-dom-testing (~> 2.2)
36
+ actionpack (7.1.3.2)
37
+ actionview (= 7.1.3.2)
38
+ activesupport (= 7.1.3.2)
39
+ nokogiri (>= 1.8.5)
40
+ racc
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
39
43
  rack-test (>= 0.6.3)
40
- rails-dom-testing (~> 2.0)
41
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.8)
43
- actionpack (= 7.0.8)
44
- activerecord (= 7.0.8)
45
- activestorage (= 7.0.8)
46
- activesupport (= 7.0.8)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.3.2)
47
+ actionpack (= 7.1.3.2)
48
+ activerecord (= 7.1.3.2)
49
+ activestorage (= 7.1.3.2)
50
+ activesupport (= 7.1.3.2)
47
51
  globalid (>= 0.6.0)
48
52
  nokogiri (>= 1.8.5)
49
- actionview (7.0.8)
50
- activesupport (= 7.0.8)
53
+ actionview (7.1.3.2)
54
+ activesupport (= 7.1.3.2)
51
55
  builder (~> 3.1)
52
- erubi (~> 1.4)
53
- rails-dom-testing (~> 2.0)
54
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.8)
56
- activesupport (= 7.0.8)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.3.2)
60
+ activesupport (= 7.1.3.2)
57
61
  globalid (>= 0.3.6)
58
- activemodel (7.0.8)
59
- activesupport (= 7.0.8)
60
- activerecord (7.0.8)
61
- activemodel (= 7.0.8)
62
- activesupport (= 7.0.8)
63
- activestorage (7.0.8)
64
- actionpack (= 7.0.8)
65
- activejob (= 7.0.8)
66
- activerecord (= 7.0.8)
67
- activesupport (= 7.0.8)
62
+ activemodel (7.1.3.2)
63
+ activesupport (= 7.1.3.2)
64
+ activerecord (7.1.3.2)
65
+ activemodel (= 7.1.3.2)
66
+ activesupport (= 7.1.3.2)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.3.2)
69
+ actionpack (= 7.1.3.2)
70
+ activejob (= 7.1.3.2)
71
+ activerecord (= 7.1.3.2)
72
+ activesupport (= 7.1.3.2)
68
73
  marcel (~> 1.0)
69
- mini_mime (>= 1.1.0)
70
- activesupport (7.0.8)
74
+ activesupport (7.1.3.2)
75
+ base64
76
+ bigdecimal
71
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
72
80
  i18n (>= 1.6, < 2)
73
81
  minitest (>= 5.1)
82
+ mutex_m
74
83
  tzinfo (~> 2.0)
75
- addressable (2.8.5)
84
+ addressable (2.8.6)
76
85
  public_suffix (>= 2.0.2, < 6.0)
77
- amazing_print (1.5.0)
86
+ amazing_print (1.6.0)
78
87
  amq-protocol (2.3.2)
79
88
  ast (2.4.2)
80
- bigdecimal (3.1.4)
89
+ base64 (0.2.0)
90
+ bigdecimal (3.1.7)
81
91
  builder (3.2.4)
82
92
  bunny (2.22.0)
83
93
  amq-protocol (~> 2.3, >= 2.3.1)
84
94
  sorted_set (~> 1, >= 1.0.2)
85
- ci-helper (0.5.0)
86
- colorize (~> 0.8)
87
- dry-inflector (~> 0.2)
88
- umbrellio-sequel-plugins (~> 0.4)
95
+ ci-helper (0.6.0)
96
+ colorize (~> 1.1)
97
+ dry-inflector (~> 1.0)
98
+ umbrellio-sequel-plugins (~> 0.14)
89
99
  coderay (1.1.3)
90
- colorize (0.8.1)
91
- concurrent-ruby (1.2.2)
100
+ colorize (1.1.0)
101
+ concurrent-ruby (1.2.3)
102
+ connection_pool (2.4.1)
92
103
  crass (1.0.6)
93
- date (3.3.3)
94
- diff-lcs (1.5.0)
104
+ date (3.3.4)
105
+ diff-lcs (1.5.1)
95
106
  docile (1.4.0)
96
- domain_name (0.5.20190701)
97
- unf (>= 0.0.5, < 1.0.0)
98
- dry-inflector (0.3.0)
107
+ domain_name (0.6.20240107)
108
+ drb (2.2.1)
109
+ dry-inflector (1.0.0)
99
110
  erubi (1.12.0)
100
- ffi (1.15.5)
101
- ffi-compiler (1.0.1)
102
- ffi (>= 1.0.0)
111
+ ffi (1.16.3)
112
+ ffi-compiler (1.3.2)
113
+ ffi (>= 1.15.5)
103
114
  rake
104
115
  globalid (1.2.1)
105
116
  activesupport (>= 6.1)
106
- http (5.1.1)
117
+ http (5.2.0)
107
118
  addressable (~> 2.8)
119
+ base64 (~> 0.1)
108
120
  http-cookie (~> 1.0)
109
121
  http-form_data (~> 2.2)
110
- llhttp-ffi (~> 0.4.0)
122
+ llhttp-ffi (~> 0.5.0)
111
123
  http-cookie (1.0.5)
112
124
  domain_name (~> 0.5)
113
125
  http-form_data (2.3.0)
114
- i18n (1.14.1)
126
+ i18n (1.14.4)
115
127
  concurrent-ruby (~> 1.0)
116
- json (2.6.3)
117
- lamian (1.7.0)
128
+ io-console (0.7.2)
129
+ irb (1.12.0)
130
+ rdoc
131
+ reline (>= 0.4.2)
132
+ json (2.7.2)
133
+ lamian (1.8.0)
118
134
  rails (>= 4.2)
119
- llhttp-ffi (0.4.0)
135
+ llhttp-ffi (0.5.0)
120
136
  ffi-compiler (~> 1.0)
121
137
  rake (~> 13.0)
122
- loofah (2.21.3)
138
+ loofah (2.22.0)
123
139
  crass (~> 1.0.2)
124
140
  nokogiri (>= 1.12.0)
125
141
  mail (2.8.1)
@@ -127,38 +143,40 @@ GEM
127
143
  net-imap
128
144
  net-pop
129
145
  net-smtp
130
- marcel (1.0.2)
146
+ marcel (1.0.4)
131
147
  memery (1.5.0)
132
148
  ruby2_keywords (~> 0.0.2)
133
- method_source (1.0.0)
149
+ method_source (1.1.0)
134
150
  mini_mime (1.1.5)
135
- minitest (5.20.0)
136
- net-imap (0.3.7)
151
+ mini_portile2 (2.8.6)
152
+ minitest (5.22.3)
153
+ mutex_m (0.2.0)
154
+ net-imap (0.4.10)
137
155
  date
138
156
  net-protocol
139
157
  net-pop (0.1.2)
140
158
  net-protocol
141
- net-protocol (0.2.1)
159
+ net-protocol (0.2.2)
142
160
  timeout
143
- net-smtp (0.3.3)
161
+ net-smtp (0.5.0)
144
162
  net-protocol
145
- nio4r (2.5.9)
146
- nokogiri (1.16.2-arm64-darwin)
163
+ nio4r (2.7.1)
164
+ nokogiri (1.15.6)
165
+ mini_portile2 (~> 2.8.2)
147
166
  racc (~> 1.4)
148
- nokogiri (1.16.2-x86_64-darwin)
149
- racc (~> 1.4)
150
- nokogiri (1.16.2-x86_64-linux)
151
- racc (~> 1.4)
152
- nori (2.6.0)
153
- parallel (1.23.0)
154
- parser (3.2.2.3)
167
+ nori (2.7.0)
168
+ bigdecimal
169
+ parallel (1.24.0)
170
+ parser (3.3.0.5)
155
171
  ast (~> 2.4.1)
156
172
  racc
157
- pg (1.5.4)
173
+ pg (1.5.6)
158
174
  pry (0.14.2)
159
175
  coderay (~> 1.1)
160
176
  method_source (~> 1.0)
161
- public_suffix (5.0.3)
177
+ psych (5.1.2)
178
+ stringio
179
+ public_suffix (5.0.5)
162
180
  rabbit_messaging (0.13.0)
163
181
  bunny (~> 2.0)
164
182
  lamian
@@ -166,23 +184,28 @@ GEM
166
184
  sneakers (~> 2.0)
167
185
  tainbox
168
186
  racc (1.7.3)
169
- rack (2.2.8)
187
+ rack (3.0.10)
188
+ rack-session (2.0.0)
189
+ rack (>= 3.0.0)
170
190
  rack-test (2.1.0)
171
191
  rack (>= 1.3)
172
- rails (7.0.8)
173
- actioncable (= 7.0.8)
174
- actionmailbox (= 7.0.8)
175
- actionmailer (= 7.0.8)
176
- actionpack (= 7.0.8)
177
- actiontext (= 7.0.8)
178
- actionview (= 7.0.8)
179
- activejob (= 7.0.8)
180
- activemodel (= 7.0.8)
181
- activerecord (= 7.0.8)
182
- activestorage (= 7.0.8)
183
- activesupport (= 7.0.8)
192
+ rackup (2.1.0)
193
+ rack (>= 3)
194
+ webrick (~> 1.8)
195
+ rails (7.1.3.2)
196
+ actioncable (= 7.1.3.2)
197
+ actionmailbox (= 7.1.3.2)
198
+ actionmailer (= 7.1.3.2)
199
+ actionpack (= 7.1.3.2)
200
+ actiontext (= 7.1.3.2)
201
+ actionview (= 7.1.3.2)
202
+ activejob (= 7.1.3.2)
203
+ activemodel (= 7.1.3.2)
204
+ activerecord (= 7.1.3.2)
205
+ activestorage (= 7.1.3.2)
206
+ activesupport (= 7.1.3.2)
184
207
  bundler (>= 1.15.0)
185
- railties (= 7.0.8)
208
+ railties (= 7.1.3.2)
186
209
  rails-dom-testing (2.2.0)
187
210
  activesupport (>= 5.0.0)
188
211
  minitest
@@ -190,34 +213,39 @@ GEM
190
213
  rails-html-sanitizer (1.6.0)
191
214
  loofah (~> 2.21)
192
215
  nokogiri (~> 1.14)
193
- railties (7.0.8)
194
- actionpack (= 7.0.8)
195
- activesupport (= 7.0.8)
196
- method_source
216
+ railties (7.1.3.2)
217
+ actionpack (= 7.1.3.2)
218
+ activesupport (= 7.1.3.2)
219
+ irb
220
+ rackup (>= 1.0.0)
197
221
  rake (>= 12.2)
198
- thor (~> 1.0)
199
- zeitwerk (~> 2.5)
222
+ thor (~> 1.0, >= 1.2.2)
223
+ zeitwerk (~> 2.6)
200
224
  rainbow (3.1.1)
201
- rake (13.0.6)
225
+ rake (13.2.1)
202
226
  rbtree (0.4.6)
203
- regexp_parser (2.8.1)
227
+ rdoc (6.6.3.1)
228
+ psych (>= 4.0.0)
229
+ regexp_parser (2.9.0)
230
+ reline (0.5.1)
231
+ io-console (~> 0.5)
204
232
  rexml (3.2.6)
205
- rspec (3.12.0)
206
- rspec-core (~> 3.12.0)
207
- rspec-expectations (~> 3.12.0)
208
- rspec-mocks (~> 3.12.0)
209
- rspec-core (3.12.2)
210
- rspec-support (~> 3.12.0)
211
- rspec-expectations (3.12.3)
233
+ rspec (3.13.0)
234
+ rspec-core (~> 3.13.0)
235
+ rspec-expectations (~> 3.13.0)
236
+ rspec-mocks (~> 3.13.0)
237
+ rspec-core (3.13.0)
238
+ rspec-support (~> 3.13.0)
239
+ rspec-expectations (3.13.0)
212
240
  diff-lcs (>= 1.2.0, < 2.0)
213
- rspec-support (~> 3.12.0)
241
+ rspec-support (~> 3.13.0)
214
242
  rspec-json_matcher (0.2.0)
215
243
  amazing_print
216
244
  json
217
- rspec-mocks (3.12.6)
245
+ rspec-mocks (3.13.0)
218
246
  diff-lcs (>= 1.2.0, < 2.0)
219
- rspec-support (~> 3.12.0)
220
- rspec-support (3.12.1)
247
+ rspec-support (~> 3.13.0)
248
+ rspec-support (3.13.1)
221
249
  rubocop (1.50.2)
222
250
  json (~> 2.3)
223
251
  parallel (~> 1.10)
@@ -228,9 +256,9 @@ GEM
228
256
  rubocop-ast (>= 1.28.0, < 2.0)
229
257
  ruby-progressbar (~> 1.7)
230
258
  unicode-display_width (>= 2.4.0, < 3.0)
231
- rubocop-ast (1.29.0)
232
- parser (>= 3.2.1.0)
233
- rubocop-capybara (2.18.0)
259
+ rubocop-ast (1.31.2)
260
+ parser (>= 3.3.0.4)
261
+ rubocop-capybara (2.20.0)
234
262
  rubocop (~> 1.41)
235
263
  rubocop-config-umbrellio (1.50.0.85)
236
264
  rubocop (~> 1.50.0)
@@ -256,15 +284,15 @@ GEM
256
284
  ruby-progressbar (1.13.0)
257
285
  ruby2_keywords (0.0.5)
258
286
  self_data (1.3.0)
259
- semantic_logger (4.14.0)
287
+ semantic_logger (4.15.0)
260
288
  concurrent-ruby (~> 1.0)
261
- sequel (5.72.0)
289
+ sequel (5.79.0)
262
290
  bigdecimal
263
291
  sequel-batches (2.0.2)
264
292
  sequel
265
293
  serverengine (2.0.7)
266
294
  sigdump (~> 0.2.2)
267
- set (1.0.3)
295
+ set (1.1.0)
268
296
  sigdump (0.2.5)
269
297
  simplecov (0.22.0)
270
298
  docile (~> 1.1)
@@ -282,36 +310,36 @@ GEM
282
310
  sorted_set (1.0.3)
283
311
  rbtree
284
312
  set (~> 1.0)
313
+ stringio (3.1.0)
285
314
  symbiont-ruby (0.7.0)
286
- table_sync (6.4.1)
315
+ table_sync (6.5.0)
287
316
  memery
288
317
  rabbit_messaging (~> 0.13)
289
318
  rails
290
319
  self_data
291
320
  tainbox (2.1.2)
292
321
  activesupport
293
- thor (1.2.2)
322
+ thor (1.3.1)
294
323
  timecop (0.9.8)
295
- timeout (0.4.0)
324
+ timeout (0.4.1)
296
325
  tzinfo (2.0.6)
297
326
  concurrent-ruby (~> 1.0)
298
- umbrellio-sequel-plugins (0.14.0.187)
327
+ umbrellio-sequel-plugins (0.14.0.192)
299
328
  sequel
300
329
  symbiont-ruby
301
- unf (0.1.4)
302
- unf_ext
303
- unf_ext (0.0.8.2)
304
- unicode-display_width (2.4.2)
330
+ unicode-display_width (2.5.0)
331
+ webrick (1.8.1)
305
332
  websocket-driver (0.7.6)
306
333
  websocket-extensions (>= 0.1.0)
307
334
  websocket-extensions (0.1.5)
308
- yard (0.9.34)
309
- zeitwerk (2.6.11)
335
+ yard (0.9.36)
336
+ zeitwerk (2.6.13)
310
337
 
311
338
  PLATFORMS
312
339
  arm64-darwin-20
313
340
  arm64-darwin-21
314
341
  arm64-darwin-23
342
+ ruby
315
343
  x86_64-darwin-20
316
344
  x86_64-linux
317
345
 
@@ -320,7 +348,7 @@ DEPENDENCIES
320
348
  bundler
321
349
  ci-helper
322
350
  http
323
- nokogiri
351
+ nokogiri (~> 1.15.0)
324
352
  nori
325
353
  pg
326
354
  pry
@@ -339,4 +367,4 @@ DEPENDENCIES
339
367
  yard
340
368
 
341
369
  BUNDLED WITH
342
- 2.4.5
370
+ 2.5.9
@@ -4,8 +4,8 @@ module UmbrellioUtils
4
4
  module Checks
5
5
  extend self
6
6
 
7
- EMAIL_REGEXP = /\A([\w+-].?)+@[a-z\d-]+(\.[a-z]+)*\.[a-z]+\z/i.freeze
8
- HOLDER_NAME_REGEXP = /\A([A-Za-z0-9.'-]+ ?)+\z/.freeze
7
+ EMAIL_REGEXP = /\A([\w+-].?)+@[a-z\d-]+(\.[a-z]+)*\.[a-z]+\z/i
8
+ HOLDER_NAME_REGEXP = /\A([A-Za-z0-9.'-]+ ?)+\z/
9
9
 
10
10
  def secure_compare(src, dest)
11
11
  ActiveSupport::SecurityUtils.secure_compare(
@@ -9,7 +9,7 @@ module UmbrellioUtils
9
9
  HTTP_X_HTTP_AUTHORIZATION
10
10
  HTTP_REDIRECT_X_HTTP_AUTHORIZATION
11
11
  ].freeze
12
- CARD_TRUNCATED_PAN_REGEX = /\A(\d{6}).*(\d{4})\z/.freeze
12
+ CARD_TRUNCATED_PAN_REGEX = /\A(\d{6}).*(\d{4})\z/
13
13
 
14
14
  def try_to_parse_as_json(data)
15
15
  JSON.parse(data) rescue data
@@ -21,7 +21,8 @@ module UmbrellioUtils
21
21
  }.freeze
22
22
 
23
23
  # Returns a new instance of the {UmbrellioUtils::SemanticLogger::TinyJsonFormatter}.
24
- # @param [Hash] custom_names_mapping mapping from default field names to custom ones.
24
+ # @option [Integer] message_size_limit maximum number of characters in a log message
25
+ # @option [Hash] custom_names_mapping mapping from default field names to custom ones.
25
26
  # @option custom_names_mapping [Symbol] :severity custom name for the `severity` field.
26
27
  # @option custom_names_mapping [Symbol] :name custom name for the `name` field.
27
28
  # @option custom_names_mapping [Symbol] :thread_fingerprint
@@ -36,7 +37,8 @@ module UmbrellioUtils
36
37
  # ) #=> <UmbrellioUtils::SemanticLogger::TinyJsonFormatter:0x000>
37
38
  # @return [UmbrellioUtils::SemanticLogger::TinyJsonFormatter]
38
39
  # a new instance of the {UmbrellioUtils::SemanticLogger::TinyJsonFormatter}
39
- def initialize(**custom_names_mapping)
40
+ def initialize(message_size_limit: 10_000, custom_names_mapping: {})
41
+ self.message_size_limit = message_size_limit
40
42
  self.field_names = { **DEFAULT_NAMES_MAPPING, **custom_names_mapping }.freeze
41
43
  end
42
44
 
@@ -53,7 +55,7 @@ module UmbrellioUtils
53
55
 
54
56
  # @!attribute field_names
55
57
  # @return [Hash<Symbol, Symbol>] the mapping from default field names to the new ones.
56
- attr_accessor :field_names
58
+ attr_accessor :message_size_limit, :field_names
57
59
 
58
60
  # Builds hash with data from log.
59
61
  # @return [Hash] the hash, which will be converted to the JSON later.
@@ -69,8 +71,8 @@ module UmbrellioUtils
69
71
  [
70
72
  log.level.upcase,
71
73
  log.name,
72
- thread_fingerprint_for(log),
73
- log_to_message(log),
74
+ thread_fingerprint,
75
+ truncate(log_to_message(log)),
74
76
  log.tags,
75
77
  log.named_tags,
76
78
  log.time.utc.iso8601(9),
@@ -79,8 +81,8 @@ module UmbrellioUtils
79
81
 
80
82
  # Calculates MD5 fingerprint for the thread in which the log was made.
81
83
  # @return [String] truncated `MD5` hash.
82
- def thread_fingerprint_for(log)
83
- Digest::MD5.hexdigest("#{log.thread_name}#{Process.pid}")[0...8]
84
+ def thread_fingerprint
85
+ Digest::MD5.hexdigest("#{Thread.current.object_id}-#{Process.pid}")[0...8]
84
86
  end
85
87
 
86
88
  # Renders either exception or message of the log.
@@ -91,9 +93,18 @@ module UmbrellioUtils
91
93
  msg << "\n#{e.backtrace.join("\n")}" if e.backtrace
92
94
  msg
93
95
  else
94
- log.message
96
+ log.message.to_s
95
97
  end
96
98
  end
99
+
100
+ def truncate(msg)
101
+ return msg unless msg.size > message_size_limit
102
+
103
+ suffix = "..."
104
+ msg = msg[0, message_size_limit - suffix.size]
105
+
106
+ "#{msg}#{suffix}"
107
+ end
97
108
  end
98
109
  end
99
110
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UmbrellioUtils
4
- VERSION = "0.7.5"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -5,14 +5,14 @@ require_relative "lib/umbrellio_utils/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "umbrellio-utils"
7
7
  spec.version = UmbrellioUtils::VERSION
8
- spec.authors = ["JustAnotherDude"]
9
- spec.email = ["VanyaZ158@gmail.com"]
8
+ spec.authors = ["Team Umbrellio"]
9
+ spec.email = ["oss@umbrellio.biz"]
10
10
 
11
11
  spec.summary = "A set of utilities that speed up development"
12
12
  spec.description = "UmbrellioUtils is collection of utility classes and helpers"
13
13
  spec.homepage = "https://github.com/umbrellio/utils"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/umbrellio/utils"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbrellio-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - JustAnotherDude
7
+ - Team Umbrellio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memery
@@ -26,7 +26,7 @@ dependencies:
26
26
  version: '1'
27
27
  description: UmbrellioUtils is collection of utility classes and helpers
28
28
  email:
29
- - VanyaZ158@gmail.com
29
+ - oss@umbrellio.biz
30
30
  executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
@@ -79,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.7.0
82
+ version: 3.0.0
83
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.5.6
89
+ rubygems_version: 3.5.7
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: A set of utilities that speed up development