Class: GraphQL::GraphQLScalarType
- Inherits:
-
Configuration::Configurable
- Object
- Configuration::Configurable
- GraphQL::GraphQLScalarType
- Includes:
- GraphQLInputType, GraphQLLeafType, GraphQLNamedType, GraphQLNullableType, GraphQLOutputType, GraphQLType
- Defined in:
- lib/graphql/type/scalar_type.rb
Overview
GraphQL Scalar Type
Instance Method Summary collapse
-
#initialize(configuration) ⇒ GraphQLScalarType
constructor
A new instance of GraphQLScalarType.
- #parse_literal(ast) ⇒ Object
- #parse_value(value) ⇒ Object
- #serialize(value) ⇒ Object
- #to_s ⇒ Object
Methods included from GraphQLNullableType
Methods included from GraphQLType
Methods inherited from Configuration::Configurable
configuration, configure_with, #method_missing, new
Constructor Details
#initialize(configuration) ⇒ GraphQLScalarType
Returns a new instance of GraphQLScalarType.
29 30 31 32 |
# File 'lib/graphql/type/scalar_type.rb', line 29 def initialize(configuration) super raise RuntimeError.new("Name should present in #{self.class}") if name.nil? || name.size == 0 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GraphQL::Configuration::Configurable
Instance Method Details
#parse_literal(ast) ⇒ Object
42 43 44 |
# File 'lib/graphql/type/scalar_type.rb', line 42 def parse_literal(ast) @configuration.parse_literal.call(ast) end |
#parse_value(value) ⇒ Object
38 39 40 |
# File 'lib/graphql/type/scalar_type.rb', line 38 def parse_value(value) @configuration.parse_value.call(value) end |
#serialize(value) ⇒ Object
34 35 36 |
# File 'lib/graphql/type/scalar_type.rb', line 34 def serialize(value) @configuration.serialize.call(value) end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/graphql/type/scalar_type.rb', line 46 def to_s name end |