⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (343 Bytes)
Bug #17765
» segfault_gsub.rb
lenwood (Paul Martensen)
, 03/31/2021 11:57 AM
def
sanitize_for_prometheus
(
string_or_symbol
)
reg
=
/[^a-zA-Z_0-9]/
string_or_symbol
.
to_s
.
downcase
.
gsub
(
reg
,
'_'
)
end
def
rand_string_or_symbol
@o
||=
[(
'a'
..
'z'
).
to_a
,
(
'A'
..
'Z'
).
to_a
,
(
0
..
9
).
to_a
,
'-'
,
'.'
].
flatten
str
=
@o
.
sample
(
50
).
join
rand
>
0.5
?
str
.
to_sym
:
str
end
loop
{
sanitize_for_prometheus
rand_string_or_symbol
}
« Previous
1
2
Next »
(2-2/2)
Loading...