Sha256: cdeb4d993971c48023582d422e6c23c0668f685bce8975602e24a9504fc3006b

Contents?: true

Size: 421 Bytes

Versions: 4

Compression:

Stored size: 421 Bytes

Contents

module ActiveRecord
  module Type
    module Bigquery
      class Bytes < ActiveRecord::Type::Binary
        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
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-bigquery-adapter-1.0.3 lib/active_record/type/bigquery/bytes.rb
activerecord-bigquery-adapter-1.0.2 lib/active_record/type/bigquery/bytes.rb
activerecord-bigquery-adapter-1.0.1 lib/active_record/type/bigquery/bytes.rb
activerecord-bigquery-adapter-1.0.0 lib/active_record/type/bigquery/bytes.rb