Class: GemChanges::Change

Inherits:
Struct
  • Object
show all
Defined in:
lib/gem_changes/change.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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: gem, from: Version(from), to: Version(to))
end

Instance Attribute Details

#fromObject

Returns the value of attribute from

Returns:

  • (Object)

    the current value of from



4
5
6
# File 'lib/gem_changes/change.rb', line 4

def from
  @from
end

#gemObject

Returns the value of attribute gem

Returns:

  • (Object)

    the current value of gem



4
5
6
# File 'lib/gem_changes/change.rb', line 4

def gem
  @gem
end

#toObject

Returns the value of attribute to

Returns:

  • (Object)

    the current value of to



4
5
6
# File 'lib/gem_changes/change.rb', line 4

def to
  @to
end

Instance Method Details

#addition?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/gem_changes/change.rb', line 13

def addition?
  from.nil?
end

#change?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/gem_changes/change.rb', line 9

def change?
  to and from
end

#downgrade?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/gem_changes/change.rb', line 25

def downgrade?
  change? and to < from
end

#removal?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/gem_changes/change.rb', line 17

def removal?
  to.nil?
end

#upgrade?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/gem_changes/change.rb', line 21

def upgrade?
  change? and to > from
end