Module: NormalizeAttributes::ActiveRecord::ClassMethods
- Defined in:
- lib/normalize_attributes/active_record.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
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/normalize_attributes/active_record.rb', line 16 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 |