module Versionize::ClassMethods
Public Instance Methods
major(format=:integer)
click to toggle source
The major
method takes one optional argument format
, indicating the type of data you want the method to return (:integer
or :string
). The default format is :integer
. The return value includes only the :major
sub-version.
Examples:
Versionize.major => 0 Versionize.major(:string) => "0"
# File lib/versionize.rb, line 75 def major(format=:integer) case format when :integer @version[:major] when :string @version[:major].to_s end end
minor(format=:integer)
click to toggle source
The minor
method operates just like the major
method except that its return value includes only the :minor
sub-version.
# File lib/versionize.rb, line 91 def minor(format=:integer) case format when :integer @version[:minor] when :string @version[:minor].to_s end end
revision(format=:integer)
click to toggle source
The revision
method operates just like the major
method except that its return value includes only the :revision
sub-version.
# File lib/versionize.rb, line 107 def revision(format=:integer) case format when :integer @version[:revision] when :string @version[:revision].to_s end end
version(format=:string)
click to toggle source
The version
method takes one optional argument format
, indicating the type of data you want the method to return (:array
, :hash
, or :string
). The default format is :string
. The return value includes all three sub-versions.
Examples:
Versionize.version => "0.0.1" Versionize.version(:array) => [0,0,1] Versionize.version(:hash) => {:major=>0,:minor=>0,:revision=>1}
# File lib/versionize.rb, line 48 def version(format=:string) case format when :array [ @version[:major], @version[:minor], @version[:revision] ] when :hash @version when :string version(:array).collect {|n| n.to_s }.join '.' end end