Class: TTY::System

Inherits:
Object
  • Object
show all
Defined in:
lib/tty/system.rb,
lib/tty/system/which.rb

Defined Under Namespace

Classes: Which

Class Method Summary collapse

Class Method Details

.unix?Boolean

Check if unix platform

Returns:

  • (Boolean)


24
25
26
# File 'lib/tty/system.rb', line 24

def unix?
  RbConfig::CONFIG['host_os'] =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
end

.which(command) ⇒ Object

Find an executable in the PATH

See Also:



33
34
35
# File 'lib/tty/system.rb', line 33

def which(command)
  Which.new(command)
end

.windows?Boolean

Check if windows platform.

Returns:

  • (Boolean)


15
16
17
# File 'lib/tty/system.rb', line 15

def windows?
  RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw|windows/
end