Module: GraphQL::Define

Defined in:
lib/graphql/define.rb,
lib/graphql/define/type_definer.rb,
lib/graphql/define/assign_argument.rb,
lib/graphql/define/assign_connection.rb,
lib/graphql/define/assign_enum_value.rb,
lib/graphql/define/instance_definable.rb,
lib/graphql/define/non_null_with_bang.rb,
lib/graphql/define/assign_object_field.rb,
lib/graphql/define/no_definition_error.rb,
lib/graphql/define/defined_object_proxy.rb,
lib/graphql/define/assign_global_id_field.rb,
lib/graphql/define/assign_mutation_function.rb

Defined Under Namespace

Modules: AssignArgument, AssignConnection, AssignEnumValue, AssignGlobalIdField, AssignMutationFunction, AssignObjectField, InstanceDefinable, NonNullWithBang Classes: DefinedObjectProxy, NoDefinitionError, TypeDefiner

Class Method Summary collapse

Class Method Details

.assign_metadata_key(key) ⇒ #call(defn, value)

A helper for definitions that store their value in #metadata.

Examples:

Storing application classes with GraphQL types

# Make a custom definition
GraphQL::ObjectType.accepts_definitions(resolves_to_class_names: GraphQL::Define.(:resolves_to_class_names))

# After definition, read the key from metadata
PostType.[:resolves_to_class_names] # => [...]

Parameters:

  • key (Object)

    the key to assign in metadata

Returns:

  • (#call(defn, value))

    an assignment for .accepts_definitions which writes key to #metadata



27
28
29
# File 'lib/graphql/define.rb', line 27

def self.(key)
  GraphQL::Define::InstanceDefinable::AssignMetadataKey.new(key)
end