Method: GraphQL::Schema::Member::BaseDSLMethods#default_graphql_name
- Defined in:
- lib/graphql/schema/member/base_dsl_methods.rb
#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 |