class BrocadeAPIClient::APIVersion
Class for checking supported API versions
Attributes
major[RW]
minor[RW]
patch[RW]
Public Class Methods
new(major, minor, patch)
click to toggle source
# File lib/BrocadeAPIClient/apiversion.rb, line 16 def initialize(major, minor, patch) @major = major @minor = minor @patch = patch end
parser(version)
click to toggle source
# File lib/BrocadeAPIClient/apiversion.rb, line 37 def self.parser(version) version_array = version.split('.') validate(version_array) @major = version_array[0].to_i @minor = version_array[1].to_i @patch = version_array[2].to_i obj_v = APIVersion.new(@major, @minor, @patch) obj_v end
validate(version)
click to toggle source
# File lib/BrocadeAPIClient/apiversion.rb, line 33 def self.validate(version) raise BrocadeAPIClient::InvalidVersion if version.length != 3 end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/BrocadeAPIClient/apiversion.rb, line 22 def <=>(other) return -1 if major < other.major return 1 if major > other.major return -1 if minor < other.minor return 1 if minor > other.minor return -1 if patch < other.patch return 1 if patch > other.patch 0 end