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 =
[ 'BACKWARD', 'BACKWARD_TRANSITIVE', 'FORWARD', 'FORWARD_TRANSITIVE', 'FULL', 'FULL_TRANSITIVE', 'NONE' ].freeze
- NONE =
'NONE'
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
- #register_options ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(name, fingerprint, with_compatibility = NONE, after_compatibility = nil, *extra) ⇒ CompatibilityBreak
Returns a new instance of CompatibilityBreak.
28 29 30 31 32 33 34 |
# File 'lib/avrolution/compatibility_break.rb', line 28 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.
22 23 24 |
# File 'lib/avrolution/compatibility_break.rb', line 22 def after_compatibility @after_compatibility end |
#fingerprint ⇒ Object (readonly)
Returns the value of attribute fingerprint.
22 23 24 |
# File 'lib/avrolution/compatibility_break.rb', line 22 def fingerprint @fingerprint end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/avrolution/compatibility_break.rb', line 22 def name @name end |
#with_compatibility ⇒ Object (readonly)
Returns the value of attribute with_compatibility.
22 23 24 |
# File 'lib/avrolution/compatibility_break.rb', line 22 def with_compatibility @with_compatibility end |
Instance Method Details
#key ⇒ Object
36 37 38 |
# File 'lib/avrolution/compatibility_break.rb', line 36 def key [name, fingerprint] end |
#line ⇒ Object
44 45 46 |
# File 'lib/avrolution/compatibility_break.rb', line 44 def line [name, fingerprint, with_compatibility, after_compatibility].compact.join(' ') end |
#register_options ⇒ Object
48 49 50 51 52 |
# File 'lib/avrolution/compatibility_break.rb', line 48 def { with_compatibility: with_compatibility }.tap do || [:after_compatibility] = after_compatibility if after_compatibility.present? end end |
#validate! ⇒ Object
40 41 42 |
# File 'lib/avrolution/compatibility_break.rb', line 40 def validate! raise ValidationError.new(errors..join(', ')) unless valid? end |