Module: OS

Defined in:
lib/systemstats/os_detect.rb

Class Method Summary collapse

Class Method Details

.is?(what) ⇒ Boolean Also known as: is

Detects the current OS running

Returns:

  • (Boolean)


7
8
9
# File 'lib/systemstats/os_detect.rb', line 7

def is?(what)
  what === RbConfig::CONFIG['host_os']
end

.linux?Boolean

Returns true if operating system is Linux

Returns:

  • (Boolean)


20
21
22
# File 'lib/systemstats/os_detect.rb', line 20

def linux?
  OS.is? /linux|cygwin/
end

.mac?Boolean

Returns true if Operating system is OsX

Returns:

  • (Boolean)


25
26
27
# File 'lib/systemstats/os_detect.rb', line 25

def mac?
  OS.is?  /mac|darwin/
end

.to_sObject



12
13
14
# File 'lib/systemstats/os_detect.rb', line 12

def to_s
  RbConfig::CONFIG['host_os']
end