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