Module: Cleaners::DigitsOnly
- Defined in:
- lib/data_cleansing/cleaners.rb
Overview
Remove Non-Digit Chars Returns nil if no digit characters present
Constant Summary collapse
- DIGITS =
Regexp.compile(/\D/)
Class Method Summary collapse
Class Method Details
.call(string) ⇒ Object
111 112 113 114 115 116 |
# File 'lib/data_cleansing/cleaners.rb', line 111 def self.call(string) return string unless string.is_a?(String) string.gsub!(DIGITS, '') string.length > 0 ? string : nil end |