Sha256: a290705f54af8957806c75af41dd7bd2d8da8faf7bb45ab6c183398b52daf510

Contents?: true

Size: 471 Bytes

Versions: 20

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  module Types
    class Float < GraphQL::Schema::Scalar
      description "Represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point)."

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

      def self.coerce_result(value, _ctx)
        value.to_f
      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/float.rb
graphql-1.8.17 lib/graphql/types/float.rb
graphql-1.8.16 lib/graphql/types/float.rb
graphql-1.8.15 lib/graphql/types/float.rb
graphql-1.9.0.pre4 lib/graphql/types/float.rb
graphql-1.8.14 lib/graphql/types/float.rb
graphql-1.9.0.pre3 lib/graphql/types/float.rb
graphql-1.9.0.pre2 lib/graphql/types/float.rb
graphql-1.8.13 lib/graphql/types/float.rb
graphql-1.8.12 lib/graphql/types/float.rb
graphql-1.9.0.pre1 lib/graphql/types/float.rb
graphql-1.8.11 lib/graphql/types/float.rb
graphql-1.8.10 lib/graphql/types/float.rb
graphql-1.8.9 lib/graphql/types/float.rb
graphql-1.8.8 lib/graphql/types/float.rb
graphql-1.8.7 lib/graphql/types/float.rb
graphql-1.8.6 lib/graphql/types/float.rb
graphql-1.8.5 lib/graphql/types/float.rb
graphql-1.8.4 lib/graphql/types/float.rb
graphql-1.8.3 lib/graphql/types/float.rb