Sha256: 9a73501bb92782536f05ffcae336246c2c9ca4b1b390959cfbd7ca16f8479e99

Contents?: true

Size: 630 Bytes

Versions: 18

Compression:

Stored size: 630 Bytes

Contents

require 'rbconfig'

module Overcommit
  # Methods relating to the current operating system
  module OS
    class << self
      def windows?
        !(/mswin|msys|mingw|bccwin|wince|emc/ =~ host_os).nil?
      end

      def cygwin?
        !(/cygwin/ =~ host_os).nil?
      end

      def mac?
        !(/darwin|mac os/ =~ host_os).nil?
      end

      def unix?
        !windows?
      end

      def linux?
        unix? && !mac? && !cygwin?
      end

      private

      def host_os
        @os ||= ::RbConfig::CONFIG['host_os'].freeze
      end
    end

    SEPARATOR = (windows? ? '\\' : File::SEPARATOR).freeze
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
overcommit-0.44.0 lib/overcommit/os.rb
overcommit-0.43.0 lib/overcommit/os.rb
overcommit-0.42.0 lib/overcommit/os.rb
overcommit-0.41.0 lib/overcommit/os.rb
overcommit-0.40.0 lib/overcommit/os.rb
overcommit-0.39.1 lib/overcommit/os.rb
overcommit-0.39.0 lib/overcommit/os.rb
overcommit-0.38.0 lib/overcommit/os.rb
overcommit-0.37.0 lib/overcommit/os.rb
overcommit-0.36.0 lib/overcommit/os.rb
overcommit-0.35.0 lib/overcommit/os.rb
overcommit-0.34.2 lib/overcommit/os.rb
overcommit-0.34.1 lib/overcommit/os.rb
overcommit-0.34.0 lib/overcommit/os.rb
overcommit-0.33.0 lib/overcommit/os.rb
overcommit-0.32.0 lib/overcommit/os.rb
overcommit-0.32.0.rc1 lib/overcommit/os.rb
overcommit-0.31.0 lib/overcommit/os.rb