Class: Launchy::Detect::HostOsFamily
Overview
Detect the current host os family
If the current host familiy cannot be detected then return HostOsFamily::Unknown
Defined Under Namespace
Classes: Cygwin, Darwin, Nix, NotFoundError, Windows
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
children, find_child, inherited
Constructor Details
#initialize(host_os = HostOs.new) ⇒ HostOsFamily
Returns a new instance of HostOsFamily.
30
31
32
|
# File 'lib/launchy/detect/host_os_family.rb', line 30
def initialize( host_os = HostOs.new )
@host_os = host_os
end
|
Instance Attribute Details
#host_os ⇒ Object
Returns the value of attribute host_os.
29
30
31
|
# File 'lib/launchy/detect/host_os_family.rb', line 29
def host_os
@host_os
end
|
Class Method Details
.cygwin? ⇒ Boolean
25
|
# File 'lib/launchy/detect/host_os_family.rb', line 25
def cygwin?() self == Cygwin; end
|
.darwin? ⇒ Boolean
23
|
# File 'lib/launchy/detect/host_os_family.rb', line 23
def darwin?() self == Darwin; end
|
.detect(host_os = HostOs.new) ⇒ Object
12
13
14
15
16
|
# File 'lib/launchy/detect/host_os_family.rb', line 12
def detect( host_os = HostOs.new )
found = find_child( :matches?, host_os )
return found.new( host_os ) if found
raise NotFoundError, "Unknown OS family for host os '#{host_os}'. #{Launchy.bug_report_message}"
end
|
.matches?(host_os) ⇒ Boolean
18
19
20
|
# File 'lib/launchy/detect/host_os_family.rb', line 18
def matches?( host_os )
matching_regex.match( host_os.to_s )
end
|
.nix? ⇒ Boolean
24
|
# File 'lib/launchy/detect/host_os_family.rb', line 24
def nix?() self == Nix; end
|
.windows? ⇒ Boolean
22
|
# File 'lib/launchy/detect/host_os_family.rb', line 22
def windows?() self == Windows; end
|
Instance Method Details
#cygwin? ⇒ Boolean
37
|
# File 'lib/launchy/detect/host_os_family.rb', line 37
def cygwin?() self.class.cygwin?; end
|
#darwin? ⇒ Boolean
35
|
# File 'lib/launchy/detect/host_os_family.rb', line 35
def darwin?() self.class.darwin?; end
|
#nix? ⇒ Boolean
36
|
# File 'lib/launchy/detect/host_os_family.rb', line 36
def nix?() self.class.nix?; end
|
#windows? ⇒ Boolean
34
|
# File 'lib/launchy/detect/host_os_family.rb', line 34
def windows?() self.class.windows?; end
|