Sha256: b262dd986fb35b33d010b448d5d6e29666587509fa7fad8c80d32ce440a57add
Contents?: true
Size: 446 Bytes
Versions: 46
Compression:
Stored size: 446 Bytes
Contents
require 'active_support/core_ext/class/attribute' module SimpleForm module MapType def self.extended(base) base.class_attribute :mappings base.mappings = {} end def map_type(*types) map_to = types.extract_options![:to] raise ArgumentError, "You need to give :to as option to map_type" unless map_to self.mappings = mappings.merge types.each_with_object({}) { |t, m| m[t] = map_to } end end end
Version data entries
46 entries across 46 versions & 6 rubygems