Class: GraphQL::Schema::Scalar Private

Inherits:
Member
  • Object
show all
Extended by:
Forwardable, Member::AcceptsDefinition
Defined in:
lib/graphql/schema/scalar.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

Constants included from Member::GraphQLTypeNames

Member::GraphQLTypeNames::Boolean, Member::GraphQLTypeNames::ID, Member::GraphQLTypeNames::Int

Class Method Summary collapse

Methods included from Member::TypeSystemHelpers

#kind, #list?, #non_null?, #to_list_type, #to_non_null_type, #to_type_signature

Methods included from Member::BaseDSLMethods

#accessible?, #authorized?, #description, #graphql_name, #introspection, #mutation, #name, #overridden_graphql_name, #to_graphql, #visible?

Methods included from Relay::TypeExtensions

#connection_type, #define_connection, #define_edge, #edge_type

Methods included from Member::CachedGraphQLDefinition

#graphql_definition, #initialize_copy

Class Method Details

.coerce_input(val, ctx) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'lib/graphql/schema/scalar.rb', line 11

def coerce_input(val, ctx)
  val
end

.coerce_result(val, ctx) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
# File 'lib/graphql/schema/scalar.rb', line 15

def coerce_result(val, ctx)
  val
end

.default_scalar(is_default = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
37
38
39
# File 'lib/graphql/schema/scalar.rb', line 34

def default_scalar(is_default = nil)
  if !is_default.nil?
    @default_scalar = is_default
  end
  @default_scalar
end

.kindObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
# File 'lib/graphql/schema/scalar.rb', line 30

def kind
  GraphQL::TypeKinds::SCALAR
end

.to_graphqlObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
25
26
27
28
# File 'lib/graphql/schema/scalar.rb', line 19

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.[:type_class] = self
  type_defn.default_scalar = default_scalar
  type_defn
end