module Charwidth::ActiveModel::ClassMethods

Public Instance Methods

normalize_charwidth(*attribute_names) click to toggle source
Calls superclass method
# File lib/charwidth/active_model.rb, line 6
def normalize_charwidth(*attribute_names)
  m = Module.new do
    attribute_names.each do |attribute|
      define_method "#{attribute}=" do |v|
        super(v.nil? ? nil : Charwidth.normalize(v.to_s))
      end
    end
  end
  prepend m
end