module NormalizeAttributes::Callbacks::ClassMethods

Public Instance Methods

normalize(*args, &block) click to toggle source
# File lib/normalize_attributes/callbacks.rb, line 62
def normalize(*args, &block)
  self.normalize_options ||= {}
  options = args.extract_options!

  args.each do |attr_name|
    attr_name = attr_name.to_sym

    normalize_options.tap do |o|
      o[attr_name] ||= []
      o[attr_name] << [
        [block, options[:with]].flatten.compact,
        options.except(:with)
      ]
    end
  end
end
normalize_attr(*args, &block)
Alias for: normalize
normalize_attribute(*args, &block)
Alias for: normalize
normalize_attributes(*args, &block)
Alias for: normalize
normalize_attrs(*args, &block)
Alias for: normalize