Versionize

I wanted simple version capabilities. Here they are.

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 Copyfree Open Innovation License or Detachable Public License at your discretion. For details, see COPYING.