class ActiveRecord::Type::Spanner::Bytes

Public Instance Methods

serialize(value) click to toggle source
Calls superclass method
# File lib/active_record/type/spanner/bytes.rb, line 13
def serialize value
  return super value if value.nil?

  if value.respond_to?(:read) && value.respond_to?(:rewind)
    value.rewind
    value = value.read
  end

  Base64.strict_encode64 value.force_encoding("ASCII-8BIT")
end