Class: Aurb::Base::Version
- Inherits:
-
Object
- Object
- Aurb::Base::Version
- Includes:
- Comparable
- Defined in:
- lib/aurb/base.rb
Overview
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(*args) ⇒ Version
constructor
A new instance of Version.
Constructor Details
#initialize(*args) ⇒ Version
Returns a new instance of Version.
40 41 42 |
# File 'lib/aurb/base.rb', line 40 def initialize(*args) @version = args.join('.').split(/\W+/).map &:to_i end |
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
38 39 40 |
# File 'lib/aurb/base.rb', line 38 def version @version end |
Instance Method Details
#<=>(other) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/aurb/base.rb', line 44 def <=>(other) [self.version.size, other.version.size].max.times do |i| c = self.version[i] <=> other.version[i] return c if c != 0 end end |