module Scrubba::ActiveMethods::ClassMethods

Public Instance Methods

scrub(*keys, strip: false, collapse: false) click to toggle source

Strip and/or collapse whitespace from given attributes.

# File lib/scrubba/active_methods.rb, line 13
def scrub(*keys, strip: false, collapse: false)
  before_validation do
    keys.each do |k|
      scrubba_apply(k, :strip) if strip
      scrubba_apply(k, :collapse) if collapse
    end
  end
end