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

Returns a new instance of EnumValueDeprecated.



752
753
754
755
756
757
# File 'lib/graphql/schema_comparator/changes.rb', line 752

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.



750
751
752
# File 'lib/graphql/schema_comparator/changes.rb', line 750

def criticality
  @criticality
end

#enumObject (readonly)

Returns the value of attribute enum.



750
751
752
# File 'lib/graphql/schema_comparator/changes.rb', line 750

def enum
  @enum
end

#new_enum_valueObject (readonly)

Returns the value of attribute new_enum_value.



750
751
752
# File 'lib/graphql/schema_comparator/changes.rb', line 750

def new_enum_value
  @new_enum_value
end

#old_enum_valueObject (readonly)

Returns the value of attribute old_enum_value.



750
751
752
# File 'lib/graphql/schema_comparator/changes.rb', line 750

def old_enum_value
  @old_enum_value
end

Instance Method Details

#messageObject



759
760
761
762
763
764
765
766
# File 'lib/graphql/schema_comparator/changes.rb', line 759

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

#pathObject



768
769
770
# File 'lib/graphql/schema_comparator/changes.rb', line 768

def path
  old_enum_value.path
end