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.
-
.match_os?(matcher) ⇒ Boolean
Check if platform matches given systems.
-
.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
58 59 60 |
# File 'lib/tty/system.rb', line 58 def self.editor TTY::System::Editor end |
.exists?(name) ⇒ Boolean
Check if command is available
49 50 51 |
# File 'lib/tty/system.rb', line 49 def self.exists?(name) !!which(name) end |
.match_os?(matcher) ⇒ Boolean
Check if platform matches given systems
30 31 32 |
# File 'lib/tty/system.rb', line 30 def self.match_os?(matcher) !!(RbConfig::CONFIG['host_os'] =~ matcher) end |
.unix? ⇒ Boolean
Check if unix platform
21 22 23 |
# File 'lib/tty/system.rb', line 21 def self.unix? match_os?(/(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i) end |
.which(command) ⇒ Object
Find an executable in the PATH
39 40 41 |
# File 'lib/tty/system.rb', line 39 def self.which(command) Which.new(command).which end |
.windows? ⇒ Boolean
Check if windows platform.
12 13 14 |
# File 'lib/tty/system.rb', line 12 def self.windows? match_os?(/msdos|mswin|djgpp|mingw|windows/i) end |