Class: Autoproj::PackageManagers::DebianVersion
- Inherits:
-
Object
- Object
- Autoproj::PackageManagers::DebianVersion
- Includes:
- Comparable
- Defined in:
- lib/autoproj/package_managers/debian_version.rb
Instance Attribute Summary collapse
-
#debian_revision ⇒ Object
readonly
Returns the value of attribute debian_revision.
-
#epoch ⇒ Object
readonly
Returns the value of attribute epoch.
-
#upstream_version ⇒ Object
readonly
Returns the value of attribute upstream_version.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(b) ⇒ Object
-
#initialize(version) ⇒ DebianVersion
constructor
A new instance of DebianVersion.
- #split ⇒ Object
Constructor Details
#initialize(version) ⇒ DebianVersion
Returns a new instance of DebianVersion.
11 12 13 14 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 11 def initialize(version) @version = version parse_version end |
Instance Attribute Details
#debian_revision ⇒ Object (readonly)
Returns the value of attribute debian_revision.
7 8 9 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 7 def debian_revision @debian_revision end |
#epoch ⇒ Object (readonly)
Returns the value of attribute epoch.
5 6 7 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 5 def epoch @epoch end |
#upstream_version ⇒ Object (readonly)
Returns the value of attribute upstream_version.
6 7 8 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 6 def upstream_version @upstream_version end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 4 def version @version end |
Class Method Details
.compare(a, b) ⇒ Object
28 29 30 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 28 def self.compare(a, b) new(a) <=> new(b) end |
Instance Method Details
#<=>(b) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 20 def <=>(b) (0..2).inject(0) do |result, i| return result unless result == 0 normalize(compare_fragments(split[i], b.split[i])) end end |
#split ⇒ Object
16 17 18 |
# File 'lib/autoproj/package_managers/debian_version.rb', line 16 def split [epoch, upstream_version, debian_revision] end |