Module: Scratch::Concerns::Stripify::ClassMethods

Defined in:
lib/scratch/concerns/stripify.rb

Instance Method Summary collapse

Instance Method Details

#stripify(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/scratch/concerns/stripify.rb', line 7

def stripify(options = {})
  options = HashWithIndifferentAccess.new options

  options[:before] ||= :validation
  options[:name]   ||= "stripify_before_#{options[:before]}"

  instance_eval do
    normalize options.merge(method: :strip)
  end
end