class Dry::GraphQL::TypeMappings

Class to Ruby types to GraphQL types

Public Class Methods

map_scalar(type) click to toggle source
# File lib/dry/graphql/type_mappings.rb, line 39
def map_scalar(type)
  map_type(type, scalar_mappings)
end
map_type(type, mappings = registry) click to toggle source
# 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) click to toggle source
# File lib/dry/graphql/type_mappings.rb, line 43
def scalar?(type)
  keys = scalar_mappings.keys
  keys.include?(type)
end