Sha256: fff993df308f4a56deb1f1d5bf5791f9e8a64e388568f098e71035bfa4c1dd07

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

# frozen_string_literal: true

module OAuth2
  module Version
    VERSION = '2.0.0.rc1'.freeze

  module_function

    # The version number as a string
    #
    # @return [String]
    def to_s
      VERSION
    end

    # The major version
    #
    # @return [Integer]
    def major
      to_a[0].to_i
    end

    # The minor version
    #
    # @return [Integer]
    def minor
      to_a[1].to_i
    end

    # The patch version
    #
    # @return [Integer]
    def patch
      to_a[2].to_i
    end

    # The pre-release version, if any
    #
    # @return [String, NilClass]
    def pre
      to_a[3]
    end

    # The version number as a hash
    #
    # @return [Hash]
    def to_h
      {
        major: major,
        minor: minor,
        patch: patch,
        pre: pre,
      }
    end

    # The version number as an array
    #
    # @return [Array]
    def to_a
      VERSION.split('.')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oauth2-2.0.0.rc1 lib/oauth2/version.rb