module MPV::Utils
Various utility methods for ruby-mpv.
Public Class Methods
tmpsock()
click to toggle source
# File lib/mpv/utils.rb, line 16 def self.tmpsock t = Time.now.strftime("%Y%m%d") "mpv#{t}-#{$$}-#{rand(0x100000000).to_s(36)}.sock" end
which?(util)
click to toggle source
Tests whether the given utility is available in the system path. @param util [String] the utility to test @return [Boolean] whether or not the utility is available @api private
# File lib/mpv/utils.rb, line 10 def self.which?(util) ENV["PATH"].split(File::PATH_SEPARATOR).any? do |path| File.executable?(File.join(path, util)) end end