Module Versionomy
In: lib/versionomy/interface.rb
lib/versionomy/format.rb
lib/versionomy/schema.rb
lib/versionomy/conversion/base.rb
lib/versionomy/conversion/parsing.rb
lib/versionomy/format/delimiter.rb
lib/versionomy/format/base.rb
lib/versionomy/schema/field.rb
lib/versionomy/schema/wrapper.rb
lib/versionomy/conversion.rb
lib/versionomy/format_definitions/standard.rb
lib/versionomy/format_definitions/semver.rb
lib/versionomy/format_definitions/rubygems.rb
lib/versionomy/value.rb
lib/versionomy/errors.rb
lib/versionomy/version.rb

Versionomy

The Versionomy module contains some convenience methods for creating and parsing version numbers.

Methods

Classes and Modules

Module Versionomy::Conversion
Module Versionomy::Errors
Module Versionomy::Format
Module Versionomy::Schema
Class Versionomy::Value

Constants

Formats = Format   Versionomy::Formats is an alias for Versionomy::Format, for backward compatibility with version 0.1.0 code. It is deprecated; use Versionomy::Format instead.
VERSION_STRING = ::File.read(::File.dirname(__FILE__)+'/../../Version').strip.freeze   Current gem version, as a frozen string.
VERSION = ::Versionomy.parse(VERSION_STRING, :standard)   Current gem version, as a Versionomy::Value.

Public Class methods

Create a new version number given a hash or array of values, and an optional format.

The values should either be a hash of field names and values, or an array of values that will be interpreted in field order.

The format can be specified as a format object or the name of a format registered with Versionomy::Format. If the format is omitted or set to nil, the default_format will be used.

You can also optionally provide default parameters to be used when unparsing this value or any derived from it.

Raises Versionomy::Errors::UnknownFormatError if a name is given that is not registered.

Gets the current default format. Usually this is the "standard" format returned by Versionomy::Format.standard.

Sets the default format used by other methods of this convenience interface. Usually, this is set to the "standard" format returned by Versionomy::Format.standard and should not be changed.

The format can be specified as a format object or the name of a format registered with Versionomy::Format. If the format is set to nil, the default_format will be reset to the "standard" format.

Raises Versionomy::Errors::UnknownFormatError if a name is given that is not registered.

Create a new version number given a string to parse, and an optional format.

The format can be specified as a format object or the name of a format registered with Versionomy::Format. If the format is omitted or set to nil, the default_format will be used.

The parameter hash, if present, will be passed as parsing parameters to the format.

Raises Versionomy::Errors::UnknownFormatError if a name is given that is not registered.

May raise Versionomy::Errors::ParseError if parsing failed.

Get the ruby version as a Versionomy::Value, using the builtin constants RUBY_VERSION and RUBY_PATCHLEVEL.

Convenience method for creating a version number using the Semantic Versioning format (see semver.org/).

You may pass a string to parse, or a hash with the following keys, all of which are optional:

:major:Major version number
:minor:Minor version number
:patch:Patch version number
:prerelease_suffix:A prerelease suffix (e.g. "b2")

May raise Versionomy::Errors::ParseError if parsing failed.

Get the version of the given module as a Versionomy::Value. Tries a number of common approaches to embedding version numbers into modules, such as string or array constants, submodules containing constants, or module method calls. Returns the version number, or nil if it wasn‘t found or couldn‘t be interpreted.

[Validate]