Module: GraphQL::Define::AssignEnumValue

Defined in:
lib/graphql/define/assign_enum_value.rb

Overview

Turn enum value configs into a EnumType::EnumValue and register it with the EnumType

Class Method Summary collapse

Class Method Details

.call(enum_type, name, desc = nil, deprecation_reason: nil, value: name, &block) ⇒ Object


5
6
7
8
9
10
11
12
13
14
# File 'lib/graphql/define/assign_enum_value.rb', line 5

def self.call(enum_type, name, desc = nil, deprecation_reason: nil, value: name, &block)
  enum_value = GraphQL::EnumType::EnumValue.define(
    name: name,
    description: desc,
    deprecation_reason: deprecation_reason,
    value: value,
    &block
  )
  enum_type.add_value(enum_value)
end