Module: VersionGem::Api — Documentation by YARD 0.9.44

# Module: VersionGem::Api

Defined in:
  lib/version_gem/api.rb

## Overview

Public API of this library

## Instance Method Summary collapse

- #major ⇒ Integer

  The major version.

- #minor ⇒ Integer

  The minor version.

- #patch ⇒ Integer

  The patch version.

- #pre ⇒ String, NilClass

  The pre-release version, if any.

- #to_a ⇒ Array<[Integer, String, NilClass]>

  The version number as an array of cast values.

- #to_h ⇒ Hash

  The version number as a hash.

- #to_s ⇒ String

  The version number as a string.

## Instance Method Details

### #major ⇒ `Integer`

The major version

Returns:

- (`Integer`)

    16
    17
    18
    # File 'lib/version_gem/api.rb', line 16

    def major
      @major ||= _to_a[0].to_i
    end

### #minor ⇒ `Integer`

The minor version

Returns:

- (`Integer`)

    23
    24
    25
    # File 'lib/version_gem/api.rb', line 23

    def minor
      @minor ||= _to_a[1].to_i
    end

### #patch ⇒ `Integer`

The patch version

Returns:

- (`Integer`)

    30
    31
    32
    # File 'lib/version_gem/api.rb', line 30

    def patch
      @patch ||= _to_a[2].to_i
    end

### #pre ⇒ `String`, `NilClass`

The pre-release version, if any

Returns:

- (`String`, `NilClass`)

    37
    38
    39
    # File 'lib/version_gem/api.rb', line 37

    def pre
      @pre ||= _to_a[3]
    end

### #to_a ⇒ `Array<[Integer, String, NilClass]>`

The version number as an array of cast values

Returns:

- (`Array<[Integer, String, NilClass]>`)

    56
    57
    58
    # File 'lib/version_gem/api.rb', line 56

    def to_a
      @to_a ||= [major, minor, patch, pre]
    end

### #to_h ⇒ `Hash`

The version number as a hash

Returns:

- (`Hash`)

    44
    45
    46
    47
    48
    49
    50
    51
    # File 'lib/version_gem/api.rb', line 44

    def to_h
      @to_h ||= {
        major: major,
        minor: minor,
        patch: patch,
        pre: pre
      }
    end

### #to_s ⇒ `String`

The version number as a string

Returns:

- (`String`)

    9
    10
    11
    # File 'lib/version_gem/api.rb', line 9

    def to_s
      self::VERSION
    end