Class: Hpe3parSdk::WSAPIVersion
- Inherits:
-
Object
- Object
- Hpe3parSdk::WSAPIVersion
- Includes:
- Comparable
- Defined in:
- lib/Hpe3parSdk/wsapi_version.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
Returns the value of attribute major.
-
#minor ⇒ Object
Returns the value of attribute minor.
-
#revision ⇒ Object
Returns the value of attribute revision.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other_version) ⇒ Object
-
#initialize(major, minor, revision) ⇒ WSAPIVersion
constructor
A new instance of WSAPIVersion.
- #to_s ⇒ Object
Constructor Details
#initialize(major, minor, revision) ⇒ WSAPIVersion
Returns a new instance of WSAPIVersion.
28 29 30 31 32 |
# File 'lib/Hpe3parSdk/wsapi_version.rb', line 28 def initialize(major, minor, revision) @major = major @minor = minor @revision = revision end |
Instance Attribute Details
#major ⇒ Object
Returns the value of attribute major.
15 16 17 |
# File 'lib/Hpe3parSdk/wsapi_version.rb', line 15 def major @major end |
#minor ⇒ Object
Returns the value of attribute minor.
15 16 17 |
# File 'lib/Hpe3parSdk/wsapi_version.rb', line 15 def minor @minor end |
#revision ⇒ Object
Returns the value of attribute revision.
15 16 17 |
# File 'lib/Hpe3parSdk/wsapi_version.rb', line 15 def revision @revision end |
Class Method Details
.parse(version) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# 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 |
Instance Method Details
#<=>(other_version) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 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 ⇒ Object
62 63 64 |
# File 'lib/Hpe3parSdk/wsapi_version.rb', line 62 def to_s major.to_s + '.' + minor.to_s + '.' + revision.to_s end |