class Hpe3parSdk::WSAPIVersion
Attributes
major[RW]
minor[RW]
revision[RW]
Public Class Methods
new(major, minor, revision)
click to toggle source
# File lib/Hpe3parSdk/wsapi_version.rb, line 28 def initialize(major, minor, revision) @major = major @minor = minor @revision = revision end
parse(version)
click to toggle source
# File lib/Hpe3parSdk/wsapi_version.rb, line 17 def self.parse(version) version_parts = version.split('.') validate_version(version, version_parts) @major = version_parts[0].to_i @minor = version_parts[1].to_i @revision = version_parts[2].to_i obj_version = WSAPIVersion.new(@major, @minor, @revision) return obj_version end
Private Class Methods
validate_version(version, version_parts)
click to toggle source
# File lib/Hpe3parSdk/wsapi_version.rb, line 67 def self.validate_version(version, version_parts) if version_parts.length != 3 raise 'Invalid Version detected ' + version end end
Public Instance Methods
<=>(other_version)
click to toggle source
# File lib/Hpe3parSdk/wsapi_version.rb, line 34 def <=>(other_version) if major < other_version.major return -1 end if major > other_version.major return 1 end if minor < other_version.minor return -1 end if minor > other_version.minor return 1 end if revision < other_version.revision return -1 end if revision > other_version.revision return 1 end return 0 end
to_s()
click to toggle source
# File lib/Hpe3parSdk/wsapi_version.rb, line 62 def to_s major.to_s + '.' + minor.to_s + '.' + revision.to_s end