Module: Gemmy::Patches::StringPatch::InstanceMethods::Alpha
- Defined in:
- lib/gemmy/patches/string_patch.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#alpha(opts = {}) ⇒ Object
Gsub non-alphabetical characters.
- #alpha!(opts = {}) ⇒ Object
Class Method Details
._alpha(string, bang: false, strip_whitespace: false) ⇒ Object
46 47 48 49 50 |
# File 'lib/gemmy/patches/string_patch.rb', line 46 def self._alpha(string, bang: false, strip_whitespace: false) fn = bang ? :gsub! : :gsub regex = /[^a-zA-Z0-9#{'\s' unless strip_whitespace}]/ string.send fn, regex, '' end |