Sha256: 577b437909e0be4b882c7519fb681f8e2e11a2d834f6620d453e79bfb6553bb2

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

module CommandKit
  #
  # Provides methods for determining the current OS.
  #
  # ## Examples
  #
  #     include CommandKit::OS
  #     
  #     def main(*argv)
  #       if linux?
  #         # ...
  #       elsif macos?
  #         # ...
  #       elsif windows?
  #         # ...
  #       end
  #     end
  #
  module OS
    #
    # Determines if the current OS is Linux.
    #
    # @return [Boolean]
    #
    # @api public
    #
    def linux?
      RUBY_PLATFORM.include?('linux')
    end

    #
    # Determines if the current OS is macOS.
    #
    # @return [Boolean]
    #
    # @api public
    #
    def macos?
      RUBY_PLATFORM.include?('darwin')
    end

    #
    # Determines if the current OS is Windows.
    #
    # @return [Boolean]
    #
    # @api public
    #
    def windows?
      Gem.win_platform?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
command_kit-0.1.0 lib/command_kit/os.rb