Sha256: 7ab084a602cd5afbd89368340762b0be5a9492bfcd2e0c4cc999d4607cc89e61
Contents?: true
Size: 835 Bytes
Versions: 6
Compression:
Stored size: 835 Bytes
Contents
# frozen_string_literal: true module Rails # :nodoc: module GraphQL # :nodoc: class Type # :nodoc: # Binary basically allows binary data to be shared using Base64 strings, # ensuring the UTF-8 encoding and performing the necessary conversion. # # It also rely on ActiveModel so it can easily share the same Data object. class Scalar::BinaryScalar < Scalar aliases :file desc <<~DESC The Binary scalar type represents a Base64 string. Normally used to share files and uploads. DESC class << self def as_json(value) Base64.encode64(value.to_s).chomp end def deserialize(value) ActiveModel::Type::Binary::Data.new(Base64.decode64(value)) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems