Class: GSL::Version
- Inherits:
-
Object
- Object
- GSL::Version
- Defined in:
- ext/extconf.rb
Instance Method Summary collapse
- #<(ver) ⇒ Object
- #>=(ver) ⇒ Object
-
#initialize(str) ⇒ Version
constructor
A new instance of Version.
- #inspect ⇒ Object
- #to_s ⇒ Object
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 |
#inspect ⇒ Object
11 |
# File 'ext/extconf.rb', line 11 def inspect; @str; end |
#to_s ⇒ Object
10 |
# File 'ext/extconf.rb', line 10 def to_s; @str; end |