Module: GraphQL::Schema::Member::TypeSystemHelpers
- Included in:
- Interface::DefinitionMethods, GraphQL::Schema::Member, Wrapper
- Defined in:
- lib/graphql/schema/member/type_system_helpers.rb
Overview
-- @requires_ancestor: Kernel
Instance Method Summary collapse
- #initialize ⇒ Object
-
#kind ⇒ Object
Returns.
-
#list? ⇒ Boolean
Returns.
-
#non_null? ⇒ Boolean
Returns.
-
#to_list_type ⇒ Object
Returns.
-
#to_non_null_type ⇒ Object
Returns.
- #to_type_signature ⇒ Object
Instance Method Details
#initialize ⇒ Object
11 12 13 14 15 |
# File 'lib/graphql/schema/member/type_system_helpers.rb', line 11 def initialize(...) super @to_non_null_type ||= nil @to_list_type ||= nil end |
#kind ⇒ Object
Returns
GraphQL::TypeKinds::TypeKind
:call-seq:
kind() -> GraphQL::TypeKinds::TypeKind
83 84 85 |
# File 'lib/graphql/schema/member/type_system_helpers.rb', line 83 def kind raise GraphQL::RequiredImplementationMissingError, "No `.kind` defined for #{self}" end |
#list? ⇒ Boolean
Returns
Boolean— true if this is a list type. A non-nullable list is considered a list.
:call-seq:
list?() -> bool
67 68 69 |
# File 'lib/graphql/schema/member/type_system_helpers.rb', line 67 def list? false end |
#non_null? ⇒ Boolean
Returns
Boolean— true if this is a non-nullable type. A nullable list of non-nullables is considered nullable.
:call-seq:
non_null?() -> bool
57 58 59 |
# File 'lib/graphql/schema/member/type_system_helpers.rb', line 57 def non_null? false end |
#to_list_type ⇒ Object
Returns
Schema::List— Make a list-type representation of this type
:call-seq:
to_list_type() -> Schema::List
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/graphql/schema/member/type_system_helpers.rb', line 40 def to_list_type @to_list_type || begin t = GraphQL::Schema::List.new(self) if frozen? t else @to_list_type = t end end end |
#to_non_null_type ⇒ Object
Returns
Schema::NonNull— Make a non-null-type representation of this type
:call-seq:
to_non_null_type() -> Schema::NonNull
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/graphql/schema/member/type_system_helpers.rb', line 23 def to_non_null_type @to_non_null_type || begin t = GraphQL::Schema::NonNull.new(self) if frozen? t else @to_non_null_type = t end end end |
#to_type_signature ⇒ Object
71 72 73 74 75 |
# File 'lib/graphql/schema/member/type_system_helpers.rb', line 71 def to_type_signature # Each host provides `graphql_name`, but they have no common ancestor member = self #: untyped member.graphql_name end |