Class: GSL::Version

Inherits:
Object
  • Object
show all
Defined in:
ext/extconf.rb

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Version

Returns a new instance of Version.



6
7
8
9
# File 'ext/extconf.rb', line 6

def initialize(str)
  @str = str
  @ary = str.split(".").collect { |elm| elm.to_i }
end

Instance Method Details

#<(ver) ⇒ Object



24
25
26
27
28
29
# File 'ext/extconf.rb', line 24

def <(ver)
  ary2 = ver.split(".").collect { |elm| elm.to_i }
  if @ary[0] >= ary2[0]; return false; end
  if @ary[0] >= ary2[0]; return false; end
  return true
end

#>=(ver) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'ext/extconf.rb', line 12

def >=(ver)
  ary2 = ver.split(".").collect { |elm| elm.to_i }
  if @ary[0] > ary2[0]; return true; end			
  if @ary[0] < ary2[0]; return false; end
  if @ary[1] > ary2[1]; return true; end
  if @ary[1] < ary2[1]; return false; end
  if @ary.size < ary2.size; return false; end
  if @ary.size == 3 and ary2.size == 3
    if @ary[2] < ary2[2]; return false; end
  end		
  return true
end

#inspectObject



11
# File 'ext/extconf.rb', line 11

def inspect; @str; end

#to_sObject



10
# File 'ext/extconf.rb', line 10

def to_s; @str; end