Sha256: c690de82fb321b430357cadbb450907f50e8ed20c2d8c791444631e4793e5182

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

module OAuth2
  module Version
    VERSION = to_s

  module_function

    # The major version
    #
    # @return [Integer]
    def major
      1
    end

    # The minor version
    #
    # @return [Integer]
    def minor
      4
    end

    # The patch version
    #
    # @return [Integer]
    def patch
      11
    end

    # The pre-release version, if any
    #
    # @return [String, NilClass]
    def pre
      nil
    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
      [major, minor, patch, pre].compact
    end

    # The version number as a string
    #
    # @return [String]
    def to_s
      v = [major, minor, patch].compact.join('.')
      v += "-#{pre}" if pre
      v
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oauth2-1.4.11 lib/oauth2/version.rb