Skip to content

Commit

Permalink
expand single line methods
Browse files Browse the repository at this point in the history
  • Loading branch information
copiousfreetime committed May 3, 2024
1 parent 4d53409 commit 6fe9ee1
Showing 1 changed file with 42 additions and 12 deletions.
54 changes: 42 additions & 12 deletions lib/launchy/detect/host_os_family.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ def matches?(host_os)
matching_regex.match(host_os.to_s)
end

def windows?() self == Windows; end
def darwin?() self == Darwin; end
def nix?() self == Nix; end
def cygwin?() self == Cygwin; end
def windows?
self == Windows
end

def darwin?
self == Darwin
end

def nix?
self == Nix
end

def cygwin?
self == Cygwin
end
end

attr_reader :host_os
Expand All @@ -34,10 +45,21 @@ def initialize(host_os = HostOs.new)
@host_os = host_os
end

def windows?() self.class.windows?; end
def darwin?() self.class.darwin?; end
def nix?() self.class.nix?; end
def cygwin?() self.class.cygwin?; end
def windows?
self.class.windows?
end

def darwin?
self.class.darwin?
end

def nix?
self.class.nix?
end

def cygwin?
self.class.cygwin?
end

#---------------------------
# All known host os families
Expand All @@ -48,7 +70,9 @@ def self.matching_regex
/(mingw|mswin|msys|windows)/i
end

def app_list(app) app.windows_app_list; end
def app_list(app)
app.windows_app_list
end
end

# Mac OS X family
Expand All @@ -57,7 +81,9 @@ def self.matching_regex
/(darwin|mac os)/i
end

def app_list(app) app.darwin_app_list; end
def app_list(app)
app.darwin_app_list
end
end

# All the *nix family of operating systems, and BSDs
Expand All @@ -66,7 +92,9 @@ def self.matching_regex
/(linux|bsd|aix|solaris|sunos|dragonfly)/i
end

def app_list(app) app.nix_app_list; end
def app_list(app)
app.nix_app_list
end
end

# Cygwin - if anyone is still using that
Expand All @@ -75,7 +103,9 @@ def self.matching_regex
/cygwin/i
end

def app_list(app) app.cygwin_app_list; end
def app_list(app)
app.cygwin_app_list
end
end
end
end
Expand Down

0 comments on commit 6fe9ee1

Please sign in to comment.