Sha256: 0588305ac0f3a0103c34407367e1c078e57e0074d0f915435e9ac64d976a0fa4
Contents?: true
Size: 792 Bytes
Versions: 7
Compression:
Stored size: 792 Bytes
Contents
require "tempfile" module MiniMagick # @private module Utilities module_function ## # Cross-platform way of finding an executable in the $PATH. # # @example # MiniMagick::Utilities.which('ruby') #=> "/usr/bin/ruby" # def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV.fetch('PATH').split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable? exe end end nil end def tempfile(extension) Tempfile.new(["mini_magick", extension], MiniMagick.tmpdir).tap do |tempfile| tempfile.binmode yield tempfile if block_given? tempfile.close end end end end
Version data entries
7 entries across 6 versions & 3 rubygems