Sha256: ca4070debd9cd537a5224f5acf9ce28b295558a1798ebe81d2d411106ce37a59
Contents?: true
Size: 793 Bytes
Versions: 51
Compression:
Stored size: 793 Bytes
Contents
# frozen_string_literal: true class Object def in?(_array) false end def shellescape to_s.shellescape end end class String begin require 'shellwords' require 'colored' rescue LoadError end def puts Kernel.puts self self end def print Kernel.print self self end # end end # Cross-platform way of finding an executable in the $PATH. # # which('ruby') #=> /usr/bin/ruby class Array def which each do |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 end nil end end end
Version data entries
51 entries across 49 versions & 6 rubygems