Class: Dumbo::ExtensionVersion
- Inherits:
-
Object
- Object
- Dumbo::ExtensionVersion
- Includes:
- Comparable
- Defined in:
- lib/dumbo/extension_version.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(version = "") ⇒ ExtensionVersion
constructor
A new instance of ExtensionVersion.
- #to_s ⇒ Object
Constructor Details
#initialize(version = "") ⇒ ExtensionVersion
Returns a new instance of ExtensionVersion.
7 8 9 |
# File 'lib/dumbo/extension_version.rb', line 7 def initialize(version="") @major, @minor, @patch = version.split(".").map(&:to_i) end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
5 6 7 |
# File 'lib/dumbo/extension_version.rb', line 5 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
5 6 7 |
# File 'lib/dumbo/extension_version.rb', line 5 def minor @minor end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
5 6 7 |
# File 'lib/dumbo/extension_version.rb', line 5 def patch @patch end |
Class Method Details
.sort ⇒ Object
17 18 19 |
# File 'lib/dumbo/extension_version.rb', line 17 def self.sort self.sort!{|a,b| a <=> b} end |
Instance Method Details
#<=>(other) ⇒ Object
11 12 13 14 15 |
# File 'lib/dumbo/extension_version.rb', line 11 def <=>(other) return major <=> other.major if ((major <=> other.major) != 0) return minor <=> other.minor if ((minor <=> other.minor) != 0) return patch <=> other.patch if ((patch <=> other.patch) != 0) end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/dumbo/extension_version.rb', line 21 def to_s [major,minor,patch].join('.') end |