Module: Scratch::Concerns::Nilify::ClassMethods
- Defined in:
- lib/scratch/concerns/nilify.rb
Instance Method Summary collapse
Instance Method Details
#nilify(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/scratch/concerns/nilify.rb', line 7 def nilify( = {}) = HashWithIndifferentAccess.new [:before] ||= :validation [:when] ||= :blank? [:name] ||= "nilify_before_#{[:before]}_when_#{[:when]}" instance_eval do normalize .merge(set: nil) end end |