Class: Dumbo::ExtensionVersion
- Inherits:
-
Struct
- Object
- Struct
- Dumbo::ExtensionVersion
- Includes:
- Comparable
- Defined in:
- lib/dumbo/extension_version.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
Returns the value of attribute major.
-
#minor ⇒ Object
Returns the value of attribute minor.
-
#patch ⇒ Object
Returns the value of attribute patch.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#major ⇒ Object
Returns the value of attribute major
2 3 4 |
# File 'lib/dumbo/extension_version.rb', line 2 def major @major end |
#minor ⇒ Object
Returns the value of attribute minor
2 3 4 |
# File 'lib/dumbo/extension_version.rb', line 2 def minor @minor end |
#patch ⇒ Object
Returns the value of attribute patch
2 3 4 |
# File 'lib/dumbo/extension_version.rb', line 2 def patch @patch end |
Class Method Details
.new_from_string(version) ⇒ Object
6 7 8 |
# File 'lib/dumbo/extension_version.rb', line 6 def new_from_string(version) ExtensionVersion.new(*version.split('.').map(&:to_i)) end |
.sort ⇒ Object
10 11 12 |
# File 'lib/dumbo/extension_version.rb', line 10 def sort sort! { |a, b| a <=> b } end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 18 19 |
# File 'lib/dumbo/extension_version.rb', line 15 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 |
#bump(level) ⇒ Object
21 22 23 |
# File 'lib/dumbo/extension_version.rb', line 21 def bump(level) send("bump_#{level}") end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/dumbo/extension_version.rb', line 25 def to_s to_a.compact.join('.') end |