Homepage / Report Issue / Source Code ( )
A Best-of-Breed Version Class Library
The Versus gem is a best-of-breed version number class library, providing classes for a variety of version related requirements.
The primary class of the Versus gem is the Version::Number
class. It does
exactly what one would expect, by taking a version literal and giving it a
versitle interface to query and manipulate.
v = Version::Number.new('1.2.0')
v.major #=> 1
v.minor #=> 2
v.patch #=> 0
The constructor can also take a tuple and #[]
is provided as a convenient alias.
v = Version::Number[1,2,0]
The Version::Number class has a number of useful methods, such as #satisfy
.
v.satisfy?("> 1.0")
Versus also provides a standalone constraint class.
c = Version::Constraint.new("~> 1.2.0")
Then versions can be tested against the constraint.
c.satisfy?("1.2.1")
The Version::Resolver
class is a powerful tool for taking a set of interdpendent
named version requirements and resolving them for the best solution.
A Version::File
class is provided to reading and parsing the typical project VERSION file.
Versus uses QED to provided tested demonstrations. This provides a end-user acceptance testing while also providing very readable documentation.
For API documentation checkout the YARD generated docs at RubyDoc.Info.
Versus is copyrighted open source software.
Copyright 2011 Rubyworks
Versus can be modified and redistributed in accordance with the BSD-2-Clause License.