Sha256: c4e39e7cbc888e7092c804a9d857625696b8a7de366766287dc0c4ca63ee9dd4
Contents?: true
Size: 504 Bytes
Versions: 2
Compression:
Stored size: 504 Bytes
Contents
require "charwidth" module Charwidth module ActiveModel module ClassMethods 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 end def self.included(base) base.class_eval do extend ClassMethods end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
charwidth-0.2.1 | lib/charwidth/active_model.rb |
charwidth-0.2.0 | lib/charwidth/active_model.rb |