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