Class: Gem::Release::Version::Number

Inherits:
Struct
  • Object
show all
Defined in:
lib/gem/release/version/number.rb

Constant Summary collapse

NUMBER =
/^(\d+)\.?(\d+)?\.?(\d+)?(\-|\.)?(\w+)?\.?(\d+)?$/
PRE_RELEASE =
/^(\d+)\.(\d+)\.(\d+)\.?(.*)(\d+)$/
STAGES =
%i(alpha beta pre rc)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#numberObject

Returns the value of attribute number

Returns:

  • (Object)

    the current value of number



4
5
6
# File 'lib/gem/release/version/number.rb', line 4

def number
  @number
end

#target=(value) ⇒ Object

Sets the attribute target

Parameters:

  • value (Object)

    the value to set the attribute target to.

Returns:

  • (Object)

    the newly set value



4
5
6
# File 'lib/gem/release/version/number.rb', line 4

def target=(value)
  @target = value
end

Instance Method Details

#bumpObject



10
11
12
13
14
15
16
# File 'lib/gem/release/version/number.rb', line 10

def bump
  return target if specific?
  validate_stage
  parts = [[major, minor, patch].compact.join('.')]
  parts << [stage, num].join('.') if stage
  parts.join(stage_delim)
end

#pre?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/gem/release/version/number.rb', line 18

def pre?
  !!parts[4]
end