Versionize
Not logged in

Versionize

This is the face of simple versioning.

justification

I wanted simple version capabilities. Here they are.

installation

Use the Ruby gem command to install:

$ gem install versionize

Isn't that easy?

usage

Using Versionize is dead simple right now. First require and include it, then define your version hash, and finally use the methods Versionize provides:

    #!/usr/bin/env ruby
    require 'versionize'

    class Foo
      include Versionize
      @version = {
        :major      => 1,
        :minor      => 0,
        :revision   => 2
      }
    end

    Foo.version
    Foo.version(:array)
    Foo.version(:hash)
    Foo.major
    Foo.major(:string)
    Foo.minor
    Foo.minor(:string)
    Foo.revision
    Foo.revision(:string)

The return values from this example are:

    => "1.0.2"
    => [1, 0, 2]
    => {:major=>1, :minor=>0, :revision=>2}
    => 1
    => "1"
    => 0
    => "0"
    => 2
    => "2"

That's about all there is to it.

credits

This program was written by Chad Perrin, Copyright 2012. It may (conveniently) be redistributed under the terms of the Detachable Public License. For details, see the LICENSE file.