class ActiveModel::Serializers::Xml::Serializer::Attribute
:nodoc:
:nodoc:
def compute_type
def compute_type return if value.nil? type = ActiveSupport::XmlMini::TYPE_NAMES[value.class.name] type ||= :string if value.respond_to?(:to_str) type ||= :yaml type end
def decorations
def decorations decorations = {} decorations[:encoding] = 'base64' if type == :binary decorations[:type] = type unless type == :string decorations[:nil] = true if value.nil? decorations end
def initialize(name, serializable, raw_value=nil)
def initialize(name, serializable, raw_value=nil) @name, @serializable = name, serializable raw_value = raw_value.in_time_zone if raw_value.respond_to?(:in_time_zone) @value = raw_value || @serializable.send(name) @type = compute_type end