Class: GraphqlRails::Model::FindOrBuildGraphqlType

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
lib/graphql_rails/model/find_or_build_graphql_type.rb

Overview

stores information about model specific config, like attributes and types

Direct Known Subclasses

FindOrBuildGraphqlInputType

Instance Method Summary collapse

Constructor Details

#initialize(name:, description:, attributes:, type_name:, force_define_attributes: false, implements: []) ⇒ FindOrBuildGraphqlType

rubocop:disable Metrics/ParameterLists



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/graphql_rails/model/find_or_build_graphql_type.rb', line 14

def initialize(
  name:,
  description:,
  attributes:,
  type_name:,
  force_define_attributes: false,
  implements: []
)
  @name = name
  @description = description
  @attributes = attributes
  @type_name = type_name
  @force_define_attributes = force_define_attributes
  @implements = implements
end

Instance Method Details

#callObject

rubocop:enable Metrics/ParameterLists



31
32
33
34
35
36
# File 'lib/graphql_rails/model/find_or_build_graphql_type.rb', line 31

def call
  klass.tap do
    add_attributes if new_class? || force_define_attributes
    add_interfaces
  end
end