Sha256: d0556c3c428227ca06020d2d84add3755eddf1f074db3c4e1767bf008f9319df

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

class OS

 # treat cygwin as linux
 # also treat IronRuby on mono as...linux

 if RUBY_PLATFORM =~ /cygwin/ # i386-cygwin
   WINDOZE = false
 elsif ENV['OS'] == 'Windows_NT'
   WINDOZE = true
 else
   WINDOZE = false
 end

 # OS.windows?
 # true if on windows [and/or jruby]
 # false if on linux or cygwin
 def self.windows?
  WINDOZE
 end

 def self.linux?
  !WINDOZE
 end

 class << self
   alias :windoze? :windows? #the joke one
 end

 require 'rbconfig'
 host_os = RbConfig::CONFIG['host_os']
 if host_os =~ /32/
   BITS = 32
 else
   if host_os =~ /64/
    BITS = 64
   else # cygwin
    if (1<<32).class == Fixnum
      BITS = 64
    else
      BITS = 32
    end
  end
 end


 def self.bits
  BITS
 end

 def self.java?
   if RUBY_PLATFORM =~ /java/
     true
   else
     false
   end
 end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
os-0.3.2 lib/os.rb