class ActiveModel::Type::Binary

:nodoc:

def binary?

def binary?
  true
end

def cast(value)

def cast(value)
  if value.is_a?(Data)
    value.to_s
  else
    super
  end
end

def changed_in_place?(raw_old_value, value)

def changed_in_place?(raw_old_value, value)
  old_value = deserialize(raw_old_value)
  old_value != value
end

def serialize(value)

def serialize(value)
  return if value.nil?
  Data.new(super)
end

def type

:nodoc:
def type
  :binary
end