Module: CommandKit::OS
- Defined in:
- lib/command_kit/os.rb
Overview
Provides methods for determining the current OS.
Examples
include CommandKit::OS
def main(*argv)
if linux?
# ...
elsif macos?
# ...
elsif windows?
# ...
end
end
Instance Method Summary collapse
-
#linux? ⇒ Boolean
Determines if the current OS is Linux.
-
#macos? ⇒ Boolean
Determines if the current OS is macOS.
-
#windows? ⇒ Boolean
Determines if the current OS is Windows.
Instance Method Details
#linux? ⇒ Boolean
Determines if the current OS is Linux.
27 28 29 |
# File 'lib/command_kit/os.rb', line 27 def linux? RUBY_PLATFORM.include?('linux') end |
#macos? ⇒ Boolean
Determines if the current OS is macOS.
38 39 40 |
# File 'lib/command_kit/os.rb', line 38 def macos? RUBY_PLATFORM.include?('darwin') end |
#windows? ⇒ Boolean
Determines if the current OS is Windows.
49 50 51 |
# File 'lib/command_kit/os.rb', line 49 def windows? Gem.win_platform? end |