Class: ReeString::AcronymsUnderscoreRegex

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_string/package/ree_string/functions/acronyms_underscore_regex.rb

Instance Method Summary collapse

Instance Method Details

#call(acronyms) ⇒ Object



9
10
11
12
# File 'lib/ree_lib/packages/ree_string/package/ree_string/functions/acronyms_underscore_regex.rb', line 9

def call(acronyms)
  acronym_regex = acronyms.empty? ? /(?=a)b/ : /#{acronyms.join("|")}/
  /(?:(?<=([A-Za-z\d]))|\b)(#{acronym_regex})(?=\b|[^a-z])/
end