Sha256: 10ed63ae09227801a8d36cf03cbbbb405192ff0295f89e079a9de3a461db0420

Contents?: true

Size: 480 Bytes

Versions: 36

Compression:

Stored size: 480 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)
        value && Integer(value)
      rescue ArgumentError
        nil
      end

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

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
graphql-1.11.6 lib/graphql/types/big_int.rb
graphql-1.11.5 lib/graphql/types/big_int.rb
graphql-1.11.4 lib/graphql/types/big_int.rb
graphql-1.11.3 lib/graphql/types/big_int.rb
graphql-1.11.2 lib/graphql/types/big_int.rb
graphql-1.10.14 lib/graphql/types/big_int.rb
graphql-1.11.1 lib/graphql/types/big_int.rb
graphql-1.10.13 lib/graphql/types/big_int.rb
graphql-1.11.0 lib/graphql/types/big_int.rb
graphql-1.10.12 lib/graphql/types/big_int.rb
graphql-1.10.11 lib/graphql/types/big_int.rb
graphql-1.10.10 lib/graphql/types/big_int.rb
graphql-1.10.9 lib/graphql/types/big_int.rb
graphql-1.10.8 lib/graphql/types/big_int.rb
graphql-1.10.7 lib/graphql/types/big_int.rb
graphql-1.10.6 lib/graphql/types/big_int.rb