Sha256: 9373914b5c07716288c077d1021db741dcdb46a91f42b0cfa328e80a4659306a

Contents?: true

Size: 872 Bytes

Versions: 4

Compression:

Stored size: 872 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class Schema
    class Scalar < GraphQL::Schema::Member
      extend GraphQL::Schema::Member::AcceptsDefinition

      class << self
        extend Forwardable
        def_delegators :graphql_definition, :coerce_isolated_input, :coerce_isolated_result

        def coerce_input(val, ctx)
          val
        end

        def coerce_result(val, ctx)
          val
        end

        def to_graphql
          type_defn = GraphQL::ScalarType.new
          type_defn.name = graphql_name
          type_defn.description = description
          type_defn.coerce_result = method(:coerce_result)
          type_defn.coerce_input = method(:coerce_input)
          type_defn.metadata[:type_class] = self
          type_defn
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql-1.8.2 lib/graphql/schema/scalar.rb
graphql-1.8.1 lib/graphql/schema/scalar.rb
graphql-1.8.0 lib/graphql/schema/scalar.rb
graphql-1.8.0.pre11 lib/graphql/schema/scalar.rb