class Fv::V
Attributes
major[R]
Attributes
minor[R]
Attributes
parts[R]
Attributes
patch[R]
Attributes
Public Class Methods
new(major, minor, patch)
click to toggle source
Instance methods
# File lib/fv/v.rb, line 21 def initialize(major, minor, patch) @major = major @minor = minor @patch = patch @parts = [@major, @minor, @patch] end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/fv/v.rb, line 37 def <=>(other) other = Fv.parse(other) unless other.is_a?(V) major_cmp = @major <=> other.major return major_cmp unless major_cmp.zero? minor_cmp = @minor <=> other.minor return minor_cmp unless minor_cmp.zero? patch_cmp = @patch <=> other.patch return patch_cmp if patch_cmp && !patch_cmp.zero? this_pre = prerelease? ? 0 : 1 other_pre = other.prerelease? ? 0 : 1 both_prerelease = prerelease? && other.prerelease? return this_pre <=> other_pre unless both_prerelease prerelease_compare(other) end
prerelease?()
click to toggle source
# File lib/fv/v.rb, line 33 def prerelease? !patch.is_a?(Integer) end
to_s()
click to toggle source
# File lib/fv/v.rb, line 29 def to_s parts.join('.') end
Private Instance Methods
prerelease_compare(other)
click to toggle source
# File lib/fv/v.rb, line 58 def prerelease_compare(other) # TODO end