Class: GraphQL::Define::TypeDefiner

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/graphql/define/type_definer.rb

Overview

Some conveniences for definining return & argument types.

Passed into initialization blocks, eg ObjectType#initialize, Field#initialize

Instance Method Summary collapse

Instance Method Details

#[](type) ⇒ GraphQL::ListType

Make a ListType which wraps the input type

Examples:

making a list type

list_of_strings = types[types.String]
list_of_strings.inspect
# => "[String]"

Parameters:

  • type (Type)

    A type to be wrapped in a ListType

Returns:



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

def [](type)
  type.to_list_type
end

#BooleanObject



13
# File 'lib/graphql/define/type_definer.rb', line 13

def Boolean;  GraphQL::BOOLEAN_TYPE;  end

#FloatObject



12
# File 'lib/graphql/define/type_definer.rb', line 12

def Float;    GraphQL::FLOAT_TYPE;    end

#IDObject



14
# File 'lib/graphql/define/type_definer.rb', line 14

def ID;       GraphQL::ID_TYPE;       end

#IntObject

rubocop:disable Style/MethodName



10
# File 'lib/graphql/define/type_definer.rb', line 10

def Int;      GraphQL::INT_TYPE;      end

#StringObject



11
# File 'lib/graphql/define/type_definer.rb', line 11

def String;   GraphQL::STRING_TYPE;   end