def self.property(property_name, options = {})
super
options[:from] = options[:from].to_sym if options[:from]
property_name = property_name.to_sym
if options[:from]
if property_name == options[:from]
fail ArgumentError, "Property name (#{property_name}) and :from option must not be the same"
end
translations[options[:from].to_sym] = property_name.to_sym
define_method "#{options[:from]}=" do |val|
with = options[:with] || options[:transform_with]
self[property_name.to_sym] = with.respond_to?(:call) ? with.call(val) : val
end
else
if options[:transform_with].respond_to? :call
transforms[property_name.to_sym] = options[:transform_with]
end
end
end