Class: TTY::System
- Inherits:
-
Object
- Object
- TTY::System
- Defined in:
- lib/tty/system.rb,
lib/tty/system/which.rb,
lib/tty/system/editor.rb
Defined Under Namespace
Class Method Summary collapse
-
.editor ⇒ TTY::System::Editor
Proxy to editor object.
-
.exists?(name) ⇒ Boolean
Check if command is available.
-
.unix? ⇒ Boolean
Check if unix platform.
-
.which(command) ⇒ Object
Find an executable in the PATH.
-
.windows? ⇒ Boolean
Check if windows platform.
Class Method Details
.editor ⇒ TTY::System::Editor
Proxy to editor object
50 51 52 |
# File 'lib/tty/system.rb', line 50 def self.editor TTY::System::Editor end |
.exists?(name) ⇒ Boolean
Check if command is available
41 42 43 |
# File 'lib/tty/system.rb', line 41 def self.exists?(name) !!self.which(name) end |
.unix? ⇒ Boolean
Check if unix platform
22 23 24 |
# File 'lib/tty/system.rb', line 22 def self.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
31 32 33 |
# File 'lib/tty/system.rb', line 31 def self.which(command) Which.new(command).which end |
.windows? ⇒ Boolean
Check if windows platform.
13 14 15 |
# File 'lib/tty/system.rb', line 13 def self.windows? RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw|windows/ end |