Module: Cline::Utils::Os
- Defined in:
- lib/cline/utils/os.rb,
lib/cline/utils/os/linux.rb,
lib/cline/utils/os/mingw32.rb
Overview
Provide OS-specific helpers
Defined Under Namespace
Class Attribute Summary collapse
-
.installed_host_os ⇒ String
The Host OS that has been installed.
Class Method Summary collapse
-
.install_os_methods(host_os: OS.host_os) ⇒ Object
Install OS-specific methods in this module.
Class Attribute Details
.installed_host_os ⇒ String
Returns The Host OS that has been installed.
9 10 11 |
# File 'lib/cline/utils/os.rb', line 9 def installed_host_os @installed_host_os end |
Class Method Details
.install_os_methods(host_os: OS.host_os) ⇒ Object
Install OS-specific methods in this module
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cline/utils/os.rb', line 14 def self.install_os_methods(host_os: OS.host_os) # Auto-extend with correct OS implementation at load time require_relative "os/#{host_os}.rb" host_os_module = Os.const_get(host_os.split('_').map(&:capitalize).join.to_sym) Os.installed_host_os = host_os # Clean eventually other methods that were installed before host_os_module.instance_methods.each do |method| undef_method(method) if method_defined?(method) define_method(method, host_os_module.instance_method(method)) end end |