Module: GraphQL::Schema::Member::BaseDSLMethods Private
- Includes:
- FindInheritedValue
- Included in:
- Interface::DefinitionMethods, GraphQL::Schema::Member, Resolver
- Defined in:
- lib/graphql/schema/member/base_dsl_methods.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
DSL methods shared by lots of things in the GraphQL Schema.
Defined Under Namespace
Modules: ConfigurationExtension
Instance Attribute Summary collapse
-
#default_graphql_name ⇒ Object
readonly
private
Creates the default name for a schema member.
-
#graphql_name(new_name = nil) ⇒ String
readonly
private
Call this with a new name to override the default name for this schema member; OR call it without an argument to get the name of this schema member.
Instance Method Summary collapse
-
#authorized?(object, context) ⇒ Boolean
private
-
#comment(new_comment = NOT_CONFIGURED) ⇒ String?
private
Call this method to provide a new comment; OR call it without an argument to get the comment.
-
#default_relay ⇒ Object
private
-
#description(new_description = nil) ⇒ String
private
Call this method to provide a new description; OR call it without an argument to get the description.
-
#introspection(new_introspection = nil) ⇒ Boolean
private
If true, this object is part of the introspection system.
-
#introspection? ⇒ Boolean
private
-
#mutation(mutation_class = nil) ⇒ Class
private
The mutation this type was derived from, if it was derived from a mutation.
-
#name(new_name = nil) ⇒ Object
private
Just a convenience method to point out that people should use graphql_name instead.
-
#visible?(context) ⇒ Boolean
private
Instance Attribute Details
#default_graphql_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates the default name for a schema member.
The default name is the Ruby constant name,
without any namespaces and with any -Type
suffix removed
117 118 119 120 121 122 123 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 117 def default_graphql_name @default_graphql_name ||= begin raise GraphQL::RequiredImplementationMissingError, 'Anonymous class should declare a `graphql_name`' if name.nil? g_name = -name.split("::").last g_name.end_with?("Type") ? g_name.sub(/Type\Z/, "") : g_name end end |
#graphql_name(new_name = nil) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call this with a new name to override the default name for this schema member; OR call it without an argument to get the name of this schema member
The default name is implemented in default_graphql_name
20 21 22 23 24 25 26 27 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 20 def graphql_name(new_name = nil) if new_name GraphQL::NameValidator.validate!(new_name) @graphql_name = new_name else @graphql_name ||= default_graphql_name end end |
Instance Method Details
#authorized?(object, context) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
129 130 131 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 129 def (object, context) true end |
#comment(new_comment = NOT_CONFIGURED) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call this method to provide a new comment; OR call it without an argument to get the comment
57 58 59 60 61 62 63 64 65 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 57 def comment(new_comment = NOT_CONFIGURED) if !NOT_CONFIGURED.equal?(new_comment) @comment = new_comment elsif defined?(@comment) @comment else nil end end |
#default_relay ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
133 134 135 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 133 def default_relay false end |
#description(new_description = nil) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call this method to provide a new description; OR call it without an argument to get the description
43 44 45 46 47 48 49 50 51 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 43 def description(new_description = nil) if new_description @description = new_description elsif defined?(@description) @description else @description = nil end end |
#introspection(new_introspection = nil) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns If true, this object is part of the introspection system.
86 87 88 89 90 91 92 93 94 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 86 def introspection(new_introspection = nil) if !new_introspection.nil? @introspection = new_introspection elsif defined?(@introspection) @introspection else false end end |
#introspection? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
96 97 98 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 96 def introspection? !!@introspection end |
#mutation(mutation_class = nil) ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The mutation this type was derived from, if it was derived from a mutation
102 103 104 105 106 107 108 109 110 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 102 def mutation(mutation_class = nil) if mutation_class @mutation = mutation_class elsif defined?(@mutation) @mutation else nil end end |
#name(new_name = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Just a convenience method to point out that people should use graphql_name instead
30 31 32 33 34 35 36 37 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 30 def name(new_name = nil) return super() if new_name.nil? fail( "The new name override method is `graphql_name`, not `name`. Usage: "\ "graphql_name \"#{new_name}\"" ) end |
#visible?(context) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
125 126 127 |
# File 'lib/graphql/schema/member/base_dsl_methods.rb', line 125 def visible?(context) true end |