Class: GraphQL::Schema::Scalar
- Extended by:
- Forwardable, Member::AcceptsDefinition
- Defined in:
- lib/graphql/schema/scalar.rb
Direct Known Subclasses
Types::BigInt, Types::Boolean, Types::Float, Types::ID, Types::ISO8601DateTime, Types::Int, Types::JSON, Types::String
Constant Summary
Constants included from Member::GraphQLTypeNames
Member::GraphQLTypeNames::Boolean, Member::GraphQLTypeNames::ID, Member::GraphQLTypeNames::Int
Class Method Summary collapse
-
.coerce_input(val, ctx) ⇒ Object
-
.coerce_result(val, ctx) ⇒ Object
-
.default_scalar(is_default = nil) ⇒ Object
-
.kind ⇒ Object
-
.to_graphql ⇒ Object
Methods included from Member::HasPath
Methods included from Member::RelayShortcuts
#connection_type, #connection_type_class, #edge_type, #edge_type_class
Methods included from Member::Scoped
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?, #default_graphql_name, #description, #graphql_name, #introspection, #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
11 12 13 |
# File 'lib/graphql/schema/scalar.rb', line 11 def coerce_input(val, ctx) val end |
.coerce_result(val, ctx) ⇒ Object
15 16 17 |
# File 'lib/graphql/schema/scalar.rb', line 15 def coerce_result(val, ctx) val end |
.default_scalar(is_default = nil) ⇒ Object
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 |
.kind ⇒ Object
30 31 32 |
# File 'lib/graphql/schema/scalar.rb', line 30 def kind GraphQL::TypeKinds::SCALAR end |
.to_graphql ⇒ Object
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 |