lib/runger/utils/which.rb in runger_config-4.0.0 vs lib/runger/utils/which.rb in runger_config-5.0.0

- old
+ new

@@ -1,18 +1,16 @@ # frozen_string_literal: true -module Runger - module Utils - # Cross-platform solution - # taken from https://stackoverflow.com/a/5471032 - def self.which(cmd) - exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""] - ENV["PATH"].split(File::PATH_SEPARATOR).each do |path| - exts.each do |ext| - exe = File.join(path, "#{cmd}#{ext}") - return exe if File.executable?(exe) && !File.directory?(exe) - end +module Runger::Utils + # Cross-platform solution + # taken from https://stackoverflow.com/a/5471032 + def self.which(cmd) + exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] + ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| + exts.each do |ext| + exe = File.join(path, "#{cmd}#{ext}") + return exe if File.executable?(exe) && !File.directory?(exe) end - nil end + nil end end