Class: Liminal::Openapi::Verification::StructuralDifference
- Inherits:
-
Object
- Object
- Liminal::Openapi::Verification::StructuralDifference
- Defined in:
- lib/liminal/openapi/verification/structural_difference.rb
Instance Attribute Summary collapse
-
#checked ⇒ Object
readonly
Returns the value of attribute checked.
-
#generated ⇒ Object
readonly
Returns the value of attribute generated.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #checked_label ⇒ Object
- #generated_label ⇒ Object
-
#initialize(path, checked, generated) ⇒ StructuralDifference
constructor
A new instance of StructuralDifference.
- #pointer ⇒ Object
Constructor Details
#initialize(path, checked, generated) ⇒ StructuralDifference
Returns a new instance of StructuralDifference.
45 46 47 48 49 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 45 def initialize(path, checked, generated) @path = path.freeze @checked = checked @generated = generated end |
Instance Attribute Details
#checked ⇒ Object (readonly)
Returns the value of attribute checked.
10 11 12 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 10 def checked @checked end |
#generated ⇒ Object (readonly)
Returns the value of attribute generated.
10 11 12 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 10 def generated @generated end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 10 def path @path end |
Class Method Details
.between(checked, generated, path = []) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 12 def self.between(checked, generated, path = []) return if checked.eql?(generated) return between_hashes(checked, generated, path) if checked.is_a?(Hash) && generated.is_a?(Hash) return between_arrays(checked, generated, path) if checked.is_a?(Array) && generated.is_a?(Array) new(path, checked, generated) end |
Instance Method Details
#checked_label ⇒ Object
57 58 59 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 57 def checked_label display(checked) end |
#generated_label ⇒ Object
61 62 63 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 61 def generated_label display(generated) end |
#pointer ⇒ Object
51 52 53 54 55 |
# File 'lib/liminal/openapi/verification/structural_difference.rb', line 51 def pointer return "#" if path.empty? "#/#{path.map { |part| escape_pointer(part) }.join('/')}" end |