Class: Avrolution::CompatibilityBreak
- Inherits:
-
Object
- Object
- Avrolution::CompatibilityBreak
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/avrolution/compatibility_break.rb
Constant Summary collapse
- ValidationError =
Class.new(StandardError)
- VALID_COMPATIBILITY_VALUES =
%w(BACKWARD BACKWARD_TRANSITIVE FORWARD FORWARD_TRANSITIVE FULL FULL_TRANSITIVE NONE).map(&:freeze).freeze
- NONE =
'NONE'.freeze
Instance Attribute Summary collapse
-
#after_compatibility ⇒ Object
readonly
Returns the value of attribute after_compatibility.
-
#fingerprint ⇒ Object
readonly
Returns the value of attribute fingerprint.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#with_compatibility ⇒ Object
readonly
Returns the value of attribute with_compatibility.
Instance Method Summary collapse
-
#initialize(name, fingerprint, with_compatibility = NONE, after_compatibility = nil, *extra) ⇒ CompatibilityBreak
constructor
A new instance of CompatibilityBreak.
- #key ⇒ Object
- #line ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(name, fingerprint, with_compatibility = NONE, after_compatibility = nil, *extra) ⇒ CompatibilityBreak
Returns a new instance of CompatibilityBreak.
19 20 21 22 23 24 25 |
# File 'lib/avrolution/compatibility_break.rb', line 19 def initialize(name, fingerprint, with_compatibility = NONE, after_compatibility = nil, *extra) @name = name @fingerprint = fingerprint @with_compatibility = with_compatibility.upcase @after_compatibility = after_compatibility.try(:upcase) @extra = extra end |
Instance Attribute Details
#after_compatibility ⇒ Object (readonly)
Returns the value of attribute after_compatibility.
13 14 15 |
# File 'lib/avrolution/compatibility_break.rb', line 13 def after_compatibility @after_compatibility end |
#fingerprint ⇒ Object (readonly)
Returns the value of attribute fingerprint.
13 14 15 |
# File 'lib/avrolution/compatibility_break.rb', line 13 def fingerprint @fingerprint end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/avrolution/compatibility_break.rb', line 13 def name @name end |
#with_compatibility ⇒ Object (readonly)
Returns the value of attribute with_compatibility.
13 14 15 |
# File 'lib/avrolution/compatibility_break.rb', line 13 def with_compatibility @with_compatibility end |
Instance Method Details
#key ⇒ Object
27 28 29 |
# File 'lib/avrolution/compatibility_break.rb', line 27 def key [name, fingerprint] end |
#line ⇒ Object
35 36 37 |
# File 'lib/avrolution/compatibility_break.rb', line 35 def line [name, fingerprint, with_compatibility, after_compatibility].compact.join(' ') end |
#validate! ⇒ Object
31 32 33 |
# File 'lib/avrolution/compatibility_break.rb', line 31 def validate! raise ValidationError.new(errors..join(', ')) unless valid? end |