Method: Versionize::ClassMethods#version
- Defined in:
- lib/versionize.rb
#version(format = :string) ⇒ Object
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}
48 49 50 51 52 53 54 55 56 57 |
# 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 |