Module: GraphQL::Define::AssignEnumValue

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

Class Method Summary collapse

Class Method Details

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



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

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