Method: GraphQL::Schema::EnumValue#initialize

Defined in:
lib/graphql/schema/enum_value.rb

#initialize(graphql_name, desc = nil, owner:, ast_node: nil, directives: nil, description: nil, comment: nil, value: NOT_CONFIGURED, deprecation_reason: nil, &block) ⇒ EnumValue

Returns a new instance of EnumValue.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/graphql/schema/enum_value.rb', line 33

def initialize(graphql_name, desc = nil, owner:, ast_node: nil, directives: nil, description: nil, comment: nil, value: NOT_CONFIGURED, deprecation_reason: nil, &block)
  @graphql_name = graphql_name.to_s
  GraphQL::NameValidator.validate!(@graphql_name)
  @description = desc || description
  @comment = comment
  @value = value == NOT_CONFIGURED ? @graphql_name : value
  if deprecation_reason
    self.deprecation_reason = deprecation_reason
  end
  @owner = owner
  @ast_node = ast_node
  if directives
    directives.each do |dir_class, dir_options|
      directive(dir_class, **dir_options)
    end
  end

  if block_given?
    instance_exec(self, &block)
  end
end