Sha256: d2182c12c32de043df52d94c1c29ab53685a20162bddb4405819121fa4a54c70

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 Bytes

Contents

class OS

  require 'rbconfig'
  host_os = RbConfig::CONFIG['host_os']
  if host_os =~ /mswin|mingw/
    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

  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.1 lib/os.rb