Sha256: f858257d04ecde6b0b6c131fdedcd7999f60dfded85a32f099a0d1c62180c79d
Contents?: true
Size: 683 Bytes
Versions: 1
Compression:
Stored size: 683 Bytes
Contents
module Geoptima VERSION = "0.1.4" def self.version_as_int(ver) base = 1 ver.split(/\./).reverse.inject(0) do |acc,v| acc += base * v.to_i base *= 100 acc end end def self.compare_version(expected_ver) version_as_int(expected_ver) - version_as_int(VERSION) end def self.assert_version(expected_ver) if expected_ver.to_s != VERSION diff = compare_version(expected_ver) if(diff != 0) msg = diff > 0 ? "against and older library" : "an older script" puts "Geoptima library version mismatch. Expected #{expected_ver}, found #{VERSION}. Are you running #{msg}?" exit -1 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geoptima-0.1.4 | lib/geoptima/version.rb |