Class: GraphQL::SchemaComparator::Result
- Inherits:
-
Object
- Object
- GraphQL::SchemaComparator::Result
- Defined in:
- lib/graphql/schema_comparator/result.rb
Overview
The result of a comparison between two schema versions
Instance Attribute Summary collapse
-
#breaking_changes ⇒ Object
readonly
Returns the value of attribute breaking_changes.
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#dangerous_changes ⇒ Object
readonly
Returns the value of attribute dangerous_changes.
-
#non_breaking_changes ⇒ Object
readonly
Returns the value of attribute non_breaking_changes.
Instance Method Summary collapse
-
#breaking? ⇒ Boolean
If there was a breaking change between the two schema versions.
-
#identical? ⇒ Boolean
If the two schemas were identical.
-
#initialize(changes) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(changes) ⇒ Result
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/graphql/schema_comparator/result.rb', line 7 def initialize(changes) @changes = changes.sort_by do |change| if change.breaking? 1 elsif change.dangerous? 2 else 3 end end @breaking_changes = @changes.select(&:breaking?) @non_breaking_changes = @changes.select(&:non_breaking?) @dangerous_changes = @changes.select(&:dangerous?) end |
Instance Attribute Details
#breaking_changes ⇒ Object (readonly)
Returns the value of attribute breaking_changes
5 6 7 |
# File 'lib/graphql/schema_comparator/result.rb', line 5 def breaking_changes @breaking_changes end |
#changes ⇒ Object (readonly)
Returns the value of attribute changes
5 6 7 |
# File 'lib/graphql/schema_comparator/result.rb', line 5 def changes @changes end |
#dangerous_changes ⇒ Object (readonly)
Returns the value of attribute dangerous_changes
5 6 7 |
# File 'lib/graphql/schema_comparator/result.rb', line 5 def dangerous_changes @dangerous_changes end |
#non_breaking_changes ⇒ Object (readonly)
Returns the value of attribute non_breaking_changes
5 6 7 |
# File 'lib/graphql/schema_comparator/result.rb', line 5 def non_breaking_changes @non_breaking_changes end |
Instance Method Details
#breaking? ⇒ Boolean
If there was a breaking change between the two schema versions
31 32 33 |
# File 'lib/graphql/schema_comparator/result.rb', line 31 def breaking? breaking_changes.any? end |
#identical? ⇒ Boolean
If the two schemas were identical
25 26 27 |
# File 'lib/graphql/schema_comparator/result.rb', line 25 def identical? @changes.empty? end |