Class: Launchy::Detect::HostOs

Inherits:
Object
  • Object
show all
Defined in:
lib/launchy/detect/host_os.rb

Overview

Internal: Determine the host operating system that Launchy is running on

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host_os = nil) ⇒ HostOs

Returns a new instance of HostOs.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/launchy/detect/host_os.rb', line 14

def initialize(host_os = nil)
  @host_os = host_os

  return if @host_os

  if (@host_os = override_host_os)
    Launchy.log "Using LAUNCHY_HOST_OS override value of '#{Launchy.host_os}'"
  else
    @host_os = default_host_os
  end
end

Instance Attribute Details

#host_osObject (readonly) Also known as: to_s, to_str

Returns the value of attribute host_os.



10
11
12
# File 'lib/launchy/detect/host_os.rb', line 10

def host_os
  @host_os
end

Instance Method Details

#default_host_osObject



26
27
28
# File 'lib/launchy/detect/host_os.rb', line 26

def default_host_os
  ::RbConfig::CONFIG["host_os"].downcase
end

#override_host_osObject



30
31
32
# File 'lib/launchy/detect/host_os.rb', line 30

def override_host_os
  Launchy.host_os
end