Class: GraphQL::SchemaComparator::Diff::Enum
- Inherits:
-
Object
- Object
- GraphQL::SchemaComparator::Diff::Enum
- Defined in:
- lib/graphql/schema_comparator/diff/enum.rb
Instance Method Summary collapse
- #diff ⇒ Object
-
#initialize(old_enum, new_enum, usage) ⇒ Enum
constructor
A new instance of Enum.
Constructor Details
#initialize(old_enum, new_enum, usage) ⇒ Enum
Returns a new instance of Enum.
5 6 7 8 9 10 11 12 13 |
# File 'lib/graphql/schema_comparator/diff/enum.rb', line 5 def initialize(old_enum, new_enum, usage) @old_enum = old_enum @new_enum = new_enum @old_values = old_enum.values @new_values = new_enum.values @usage = usage end |
Instance Method Details
#diff ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/graphql/schema_comparator/diff/enum.rb', line 15 def diff changes = [] changes += removed_values.map { |value| Changes::EnumValueRemoved.new(old_enum, value, usage) } changes += added_values.map { |value| Changes::EnumValueAdded.new(new_enum, value, usage) } each_common_value do |old_value, new_value| # TODO: Add Directive Stuff if old_value.description != new_value.description changes << Changes::EnumValueDescriptionChanged.new(new_enum, old_value, new_value) end if old_value.deprecation_reason != new_value.deprecation_reason changes << Changes::EnumValueDeprecated.new(new_enum, old_value, new_value) end end changes end |