Class: Dry::GraphQL::TypeMappings
- Inherits:
-
Object
- Object
- Dry::GraphQL::TypeMappings
show all
- Extended by:
- Core::ClassAttributes
- Defined in:
- lib/dry/graphql/type_mappings.rb
Overview
Class to Ruby types to GraphQL types
Defined Under Namespace
Classes: UnmappableTypeError
Class Method Summary
collapse
Class Method Details
.map_scalar(type) ⇒ Object
39
40
41
|
# File 'lib/dry/graphql/type_mappings.rb', line 39
def map_scalar(type)
map_type(type, scalar_mappings)
end
|
.map_type(type, mappings = registry) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/dry/graphql/type_mappings.rb', line 30
def map_type(type, mappings = registry)
mappings.fetch(type) do
raise UnmappableTypeError,
"Cannot map #{type}. Please make sure " \
"it is registered by calling:\n" \
"Dry::GraphQL.register_type_mapping #{type}, MyGraphQLType"
end
end
|
.scalar?(type) ⇒ Boolean
43
44
45
46
|
# File 'lib/dry/graphql/type_mappings.rb', line 43
def scalar?(type)
keys = scalar_mappings.keys
keys.include?(type)
end
|