lib/representable/definition.rb in representable-0.13.0 vs lib/representable/definition.rb in representable-0.13.1
- old
+ new
@@ -1,24 +1,19 @@
module Representable
# Created at class compile time. Keeps configuration options for one property.
class Definition
- attr_reader :name, :sought_type, :from, :default, :representer_module
+ attr_reader :name, :sought_type, :from, :default, :representer_module, :attribute
alias_method :getter, :name
def initialize(sym, options={})
@name = sym.to_s
@array = options[:collection]
@from = (options[:from] || name).to_s
- @sought_type = options[:class] || options[:as] || :text # TODO: deprecate :as in 1.0.
+ @sought_type = options[:class]
@default = options[:default]
@default ||= [] if array?
@representer_module = options[:extend] # DISCUSS: move to Representable::DCI?
-
- # FIXME: move me to xml.
- if options[:from].to_s =~ /^@/
- @sought_type = :attr
- options[:from].sub!('@', '')
- end
+ @attribute = options[:attribute]
end
def instance_variable_name
:"@#{name}"
end