Module: NormalizeAttributes::Callbacks::ClassMethods
- Defined in:
- lib/normalize_attributes/callbacks.rb
Instance Method Summary collapse
- #normalize(*args, &block) ⇒ Object (also: #normalize_attributes, #normalize_attribute, #normalize_attr, #normalize_attrs)
Instance Method Details
#normalize(*args, &block) ⇒ Object Also known as: normalize_attributes, normalize_attribute, normalize_attr, normalize_attrs
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/normalize_attributes/callbacks.rb', line 60 def normalize(*args, &block) self. ||= {} = args. args.each do |attr_name| attr_name = attr_name.to_sym .tap do |o| o[attr_name] ||= [] o[attr_name] << [ [block, [:with]].flatten.compact, .except(:with) ] end end end |