Sha256: be5e35f4bf3dd87c568cf06acd12d8698855439481cd1475f8fbb29d4beaba7c

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

# frozen_string_literal: true

module Attribool
  ##
  # Module that contains all gem version information. Follows semantic
  # versioning. Read: https://semver.org/
  module Version
    ##
    # Major version.
    #
    # @return [Integer]
    MAJOR = 1

    ##
    # Minor version.
    #
    # @return [Integer]
    MINOR = 0

    ##
    # Patch version.
    #
    # @return [Integer]
    PATCH = 1

    ##
    # Version as +[MAJOR, MINOR, PATCH]+
    #
    # @return [Array]
    def self.to_a
      [MAJOR, MINOR, PATCH]
    end

    ##
    # Version as +MAJOR.MINOR.PATCH+
    #
    # @return [String]
    def self.to_s
      to_a.join('.')
    end

    ##
    # Version as +{major: MAJOR, minor: MINOR, patch: PATCH}+
    #
    # @return [Hash]
    def self.to_h
      %i[major minor patch].zip(to_a).to_h
    end
  end

  ##
  # The version, as a string.
  #
  # @return [String]
  VERSION = Version.to_s.freeze
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attribool-1.0.1 lib/attribool/version.rb