Class: BuildrDependencyExtensions::Version
- Inherits:
-
Object
- Object
- BuildrDependencyExtensions::Version
- Includes:
- Comparable
- Defined in:
- lib/buildr-dependency-extensions/helper.rb
Overview
Parses the version string and provides a natural ordering for versions
Instance Attribute Summary collapse
-
#version_array ⇒ Object
readonly
Returns the value of attribute version_array.
-
#version_string ⇒ Object
readonly
Returns the value of attribute version_string.
Instance Method Summary collapse
- #<=>(other_version) ⇒ Object
- #hash ⇒ Object
-
#initialize(version_string) ⇒ Version
constructor
A new instance of Version.
- #to_s ⇒ Object
Constructor Details
#initialize(version_string) ⇒ Version
Returns a new instance of Version.
61 62 63 64 |
# File 'lib/buildr-dependency-extensions/helper.rb', line 61 def initialize version_string @version_string = version_string @version_array = version_string.split('.') end |
Instance Attribute Details
#version_array ⇒ Object (readonly)
Returns the value of attribute version_array.
59 60 61 |
# File 'lib/buildr-dependency-extensions/helper.rb', line 59 def version_array @version_array end |
#version_string ⇒ Object (readonly)
Returns the value of attribute version_string.
59 60 61 |
# File 'lib/buildr-dependency-extensions/helper.rb', line 59 def version_string @version_string end |
Instance Method Details
#<=>(other_version) ⇒ Object
66 67 68 |
# File 'lib/buildr-dependency-extensions/helper.rb', line 66 def <=> other_version @version_array <=> other_version.version_array end |
#hash ⇒ Object
72 73 74 |
# File 'lib/buildr-dependency-extensions/helper.rb', line 72 def hash @version_string.hash end |
#to_s ⇒ Object
76 77 78 |
# File 'lib/buildr-dependency-extensions/helper.rb', line 76 def to_s @version_string end |