Sha256: 33949310d27bbe06612bce3ee3a9b7cac321d6782685535c5a79cb58bcef0039

Contents?: true

Size: 639 Bytes

Versions: 8

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literal: false

module Trop
  # OS detection lib
  class OS
    # @return  true/false if 'on windows ?'
    def self.win?
      (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
    end

    # @return  true/false if 'on mac?'
    def self.mac?
      (/darwin/ =~ RUBY_PLATFORM) != nil
    end

    # @return  true/false if 'on unix?'
    def self.unix?
      !::Trop::OS.win?
    end

    # @return  true/false if 'on tux?'
    def self.linux?
      ::Trop::OS.unix? and not ::Trop::OS.mac?
    end

    # @return  true/false if 'on jruby?'
    def self.jruby?
      (RUBY_ENGINE == 'jruby')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trop-0.8.6 lib/trop/os.rb
trop-0.8.5 lib/trop/os.rb
trop-0.8.1 lib/trop/os.rb
trop-0.7.0 lib/trop/os.rb
trop-0.6.19 lib/trop/os.rb
trop-0.6.1 lib/trop/os.rb
trop-0.5.33 lib/trop/os.rb
trop-0.4.27 lib/trop/os.rb