Class: Uber::Version
- Inherits:
-
Hash
- Object
- Hash
- Uber::Version
- Defined in:
- lib/uber/version.rb
Instance Method Summary collapse
- #>=(version) ⇒ Object
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
- #~(*versions) ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
3 4 5 6 7 8 9 10 |
# File 'lib/uber/version.rb', line 3 def initialize(version) @version = Gem::Version.new(version) major, minor, patch = @version.segments self[:major] = major || 0 self[:minor] = minor || 0 self[:patch] = patch || 0 end |
Instance Method Details
#>=(version) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/uber/version.rb', line 12 def >=(version) major, minor, patch = parse(version) self[:major] > major or (self[:major] == major and self[:minor] >= minor and self[:patch] >= patch) end |
#~(*versions) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/uber/version.rb', line 19 def ~(*versions) !! versions.find do |v| major, minor, patch = parse(v) self[:major] == major and self[:minor] == minor end end |