add field mask

This commit is contained in:
Pete Matsyburka
2025-03-03 00:14:14 +02:00
parent 4116746be3
commit 23dcd62672
5 changed files with 40 additions and 8 deletions
+6
View File
@@ -2,6 +2,8 @@
module TextUtils
RTL_REGEXP = /[\p{Hebrew}\p{Arabic}]/
MASK_REGEXP = /[^\s\-_\[\]\(\)\+\?\.\,]/
MASK_SYMBOL = 'X'
module_function
@@ -13,6 +15,10 @@ module TextUtils
false
end
def mask_value(text)
text.to_s.gsub(MASK_REGEXP, MASK_SYMBOL)
end
def maybe_rtl_reverse(text)
if text.match?(RTL_REGEXP)
TwitterCldr::Shared::Bidi