Class: GemChanges::Change
- Inherits:
-
Struct
- Object
- Struct
- GemChanges::Change
- Defined in:
- lib/gem_changes/change.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#gem ⇒ Object
Returns the value of attribute gem.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #addition? ⇒ Boolean
- #change? ⇒ Boolean
- #downgrade? ⇒ Boolean
-
#initialize(gem:, from:, to:) ⇒ Change
constructor
A new instance of Change.
- #major? ⇒ Boolean
- #minor? ⇒ Boolean
- #patch? ⇒ Boolean
- #removal? ⇒ Boolean
- #upgrade? ⇒ Boolean
Constructor Details
#initialize(gem:, from:, to:) ⇒ Change
Returns a new instance of Change.
5 6 7 |
# File 'lib/gem_changes/change.rb', line 5 def initialize(gem:, from:, to:) super(gem:, from: Version(from), to: Version(to)) end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from
4 5 6 |
# File 'lib/gem_changes/change.rb', line 4 def from @from end |
#gem ⇒ Object
Returns the value of attribute gem
4 5 6 |
# File 'lib/gem_changes/change.rb', line 4 def gem @gem end |
#to ⇒ Object
Returns the value of attribute to
4 5 6 |
# File 'lib/gem_changes/change.rb', line 4 def to @to end |
Instance Method Details
#addition? ⇒ Boolean
13 14 15 |
# File 'lib/gem_changes/change.rb', line 13 def addition? from.nil? end |
#change? ⇒ Boolean
9 10 11 |
# File 'lib/gem_changes/change.rb', line 9 def change? to and from end |
#downgrade? ⇒ Boolean
25 26 27 |
# File 'lib/gem_changes/change.rb', line 25 def downgrade? change? and to < from end |
#major? ⇒ Boolean
29 30 31 32 33 |
# File 'lib/gem_changes/change.rb', line 29 def major? change? && from.segments[0] && to.segments[0] && from.segments[0] != to.segments[0] end |
#minor? ⇒ Boolean
35 36 37 38 39 |
# File 'lib/gem_changes/change.rb', line 35 def minor? change? && !major? && from.segments[1] && to.segments[1] && from.segments[1] != to.segments[1] end |
#patch? ⇒ Boolean
41 42 43 44 45 |
# File 'lib/gem_changes/change.rb', line 41 def patch? change? && !major? && !minor? && from.segments[2] && to.segments[2] && from.segments[2] != to.segments[2] end |
#removal? ⇒ Boolean
17 18 19 |
# File 'lib/gem_changes/change.rb', line 17 def removal? to.nil? end |
#upgrade? ⇒ Boolean
21 22 23 |
# File 'lib/gem_changes/change.rb', line 21 def upgrade? change? and to > from end |