Class: GraphQL::SchemaComparator::Changes::EnumValueDeprecated

Inherits:
AbstractChange
  • Object
show all
Defined in:
lib/graphql/schema_comparator/changes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractChange

#breaking?, #dangerous?, #non_breaking?

Constructor Details

#initialize(enum, old_enum_value, new_enum_value) ⇒ EnumValueDeprecated


543
544
545
546
547
548
# File 'lib/graphql/schema_comparator/changes.rb', line 543

def initialize(enum, old_enum_value, new_enum_value)
  @criticality = Changes::Criticality.non_breaking
  @enum = enum
  @old_enum_value = old_enum_value
  @new_enum_value = new_enum_value
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality


541
542
543
# File 'lib/graphql/schema_comparator/changes.rb', line 541

def criticality
  @criticality
end

#enumObject (readonly)

Returns the value of attribute enum


541
542
543
# File 'lib/graphql/schema_comparator/changes.rb', line 541

def enum
  @enum
end

#new_enum_valueObject (readonly)

Returns the value of attribute new_enum_value


541
542
543
# File 'lib/graphql/schema_comparator/changes.rb', line 541

def new_enum_value
  @new_enum_value
end

#old_enum_valueObject (readonly)

Returns the value of attribute old_enum_value


541
542
543
# File 'lib/graphql/schema_comparator/changes.rb', line 541

def old_enum_value
  @old_enum_value
end

Instance Method Details

#messageObject


550
551
552
553
554
555
556
557
558
# File 'lib/graphql/schema_comparator/changes.rb', line 550

def message
  if old_enum_value.deprecation_reason
    "Enum value `#{enum.name}.#{new_enum_value.name}` deprecation reason changed " \
      "from `#{old_enum_value.deprecation_reason}` to `#{new_enum_value.deprecation_reason}`"
  else
    "Enum value `#{enum.name}.#{new_enum_value.name}` was deprecated with reason" \
      " `#{new_enum_value.deprecation_reason}`"
  end
end