Class: ComparableVersion

Inherits:
Array
  • Object
show all
Defined in:
lib/gem_velocity/helpers.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(s) ⇒ ComparableVersion

Returns a new instance of ComparableVersion.



43
44
45
46
# File 'lib/gem_velocity/helpers.rb', line 43

def initialize s
  @str = s
  super(s.split('.').map { |e| e.to_i })
end

Instance Method Details

#<(x) ⇒ Object



50
51
52
# File 'lib/gem_velocity/helpers.rb', line 50

def < x
  (self <=> x) < 0
end

#==(x) ⇒ Object



56
57
58
# File 'lib/gem_velocity/helpers.rb', line 56

def == x
  (self <=> x) == 0
end

#>(x) ⇒ Object



53
54
55
# File 'lib/gem_velocity/helpers.rb', line 53

def > x
  (self <=> x) > 0
end

#strObject



47
48
49
# File 'lib/gem_velocity/helpers.rb', line 47

def str
  @str
end