Module: HasNormalizedFields
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/version.rb,
lib/has_normalized_fields.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- VERSION =
"0.0.2"
- ZIPCODE =
CONSTANT
/[-. )(,]/
- PHONE =
/[-. )(,]/
- SSN =
/[-. )(,]/
- TAXID =
/[-. )(,]/
- DOLLAR =
/[$, ]/
- NUMBER =
/[, ]/
- PERCENT =
/[%, ]/
- SPACES =
/\s/
Class Method Summary collapse
-
.normalizations(*args) ⇒ Object
instance methods.
Class Method Details
.normalizations(*args) ⇒ Object
instance methods
15 16 17 18 19 20 21 22 |
# File 'lib/has_normalized_fields.rb', line 15 def self.normalizations(*args) args.each do |arg| reg_exp = HasNormalizedFields.const_get(arg.upcase) define_method "normalize_#{arg}" do self && is_a?(String) && match(reg_exp) ? gsub!(reg_exp,'') : self end end end |