Sha256: 7a3154a63da2bab7b38a40e90ecb14d89eba552507623b7ea2d3f75b650bbcfd

Contents?: true

Size: 385 Bytes

Versions: 5

Compression:

Stored size: 385 Bytes

Contents

module GraphQL
  # The parent type for scalars, eg {GraphQL::STRING_TYPE}, {GraphQL::INT_TYPE}
  #
  class ScalarType < GraphQL::ObjectType
    defined_by_config :name, :coerce
    attr_accessor :name

    def coerce(value)
      @coerce_proc.call(value)
    end

    def coerce=(proc)
      @coerce_proc = proc
    end

    def kind
      GraphQL::TypeKinds::SCALAR
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
graphql-0.7.1 lib/graphql/scalar_type.rb
graphql-0.7.0 lib/graphql/scalar_type.rb
graphql-0.6.2 lib/graphql/scalar_type.rb
graphql-0.6.1 lib/graphql/scalar_type.rb
graphql-0.6.0 lib/graphql/scalar_type.rb