Sha256: fb301f42d1ebde395007f89f2ccd89d788b38e8509fb506fdf94c15b94141585

Contents?: true

Size: 448 Bytes

Versions: 20

Compression:

Stored size: 448 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  module Types
    class Int < GraphQL::Schema::Scalar
      description "Represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1."

      def self.coerce_input(value, _ctx)
        value.is_a?(Numeric) ? value.to_i : nil
      end

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

      default_scalar true
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
graphql-1.8.18 lib/graphql/types/int.rb
graphql-1.8.17 lib/graphql/types/int.rb
graphql-1.8.16 lib/graphql/types/int.rb
graphql-1.8.15 lib/graphql/types/int.rb
graphql-1.9.0.pre4 lib/graphql/types/int.rb
graphql-1.8.14 lib/graphql/types/int.rb
graphql-1.9.0.pre3 lib/graphql/types/int.rb
graphql-1.9.0.pre2 lib/graphql/types/int.rb
graphql-1.8.13 lib/graphql/types/int.rb
graphql-1.8.12 lib/graphql/types/int.rb
graphql-1.9.0.pre1 lib/graphql/types/int.rb
graphql-1.8.11 lib/graphql/types/int.rb
graphql-1.8.10 lib/graphql/types/int.rb
graphql-1.8.9 lib/graphql/types/int.rb
graphql-1.8.8 lib/graphql/types/int.rb
graphql-1.8.7 lib/graphql/types/int.rb
graphql-1.8.6 lib/graphql/types/int.rb
graphql-1.8.5 lib/graphql/types/int.rb
graphql-1.8.4 lib/graphql/types/int.rb
graphql-1.8.3 lib/graphql/types/int.rb