Sha256: 7dede233f64b62d2f0aae75171805f2cdaa8d5f44762c9a17e06a7d5c448b5aa

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

#|  ======================================================
#|  OS Module
#|
#|  Module to easily find the running operating system
#|  ======================================================
module OS

  #|  ------------------------------------------------------
  #|  linux? method
  #|
  #|  Returns true if the host OS is Linux (false otherwise).
  #|  @return Bool
  #|  ------------------------------------------------------
  def OS.linux?
    OS.unix? and not OS.mac?
  end
  
  #|  ------------------------------------------------------
  #|  mac? method
  #|
  #|  Returns true if the host OS is OS X (false otherwise).
  #|  @return Bool
  #|  ------------------------------------------------------
  def OS.mac?
   (/darwin/ =~ RUBY_PLATFORM) != nil
  end

  #|  ------------------------------------------------------
  #|  unix? method
  #|
  #|  Returns true if the host OS is Unix (false otherwise).
  #|  @return Bool
  #|  ------------------------------------------------------
  def OS.unix?
    !OS.windows?
  end
  
  #|  ------------------------------------------------------
  #|  windows? method
  #|
  #|  Returns true if the host OS is Windows (false otherwise).
  #|  @return Bool
  #|  ------------------------------------------------------
  def OS.windows?
    (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sifttter-redux-0.3.1 lib/sifttter-redux/os.rb
sifttter-redux-0.3.0 lib/sifttter-redux/os.rb
sifttter-redux-0.2.5 lib/sifttter-redux/os.rb
sifttter-redux-0.2.4 lib/sifttter-redux/os.rb
sifttter-redux-0.2.2 lib/sifttter-redux/os.rb
sifttter-redux-0.2.1 lib/Sifttter-Redux/os.rb
sifttter-redux-0.2.0 lib/Sifttter-Redux/os.rb