class Semver::Identifier
@api private
Attributes
value[R]
@return [String, Integer]
Public Class Methods
new(value)
click to toggle source
@param [String, Integer] value
# File lib/semver/identifier.rb, line 8 def initialize(value) @value = value end
new(value)
click to toggle source
@param [String] value
# File lib/semver/identifier.rb, line 27 def self.new(value) identifier = allocate identifier.send(:initialize, value =~ /^\d+$/ ? value.to_i : value) identifier end
Public Instance Methods
<=>(other)
click to toggle source
@return [Integer] Returns -1, 0, or 1.
# File lib/semver/identifier.rb, line 16 def <=>(other) if other.value.is_a?(value.class) value <=> other.value elsif value.is_a?(Integer) -1 else 1 end end