Sha256: 92073aafc9bfcfd075b1f0b25f3ce5351f5876d202149615aafa4afb980de4b4

Contents?: true

Size: 471 Bytes

Versions: 28

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  module Types
    class BigInt < GraphQL::Schema::Scalar
      description "Represents non-fractional signed whole numeric values. Since the value may exceed the size of a 32-bit integer, it's encoded as a string."

      def self.coerce_input(value, _ctx)
        Integer(value)
      rescue ArgumentError
        nil
      end

      def self.coerce_result(value, _ctx)
        value.to_i.to_s
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
graphql-1.9.11 lib/graphql/types/big_int.rb
graphql-1.9.10 lib/graphql/types/big_int.rb
graphql-1.9.9 lib/graphql/types/big_int.rb
graphql-1.9.8 lib/graphql/types/big_int.rb
graphql-1.9.7 lib/graphql/types/big_int.rb
graphql-1.9.6 lib/graphql/types/big_int.rb
graphql-1.9.5 lib/graphql/types/big_int.rb
graphql-1.9.4 lib/graphql/types/big_int.rb