This module contains various utility methods as module methods.
Methods
- C
- G
- I
- P
- S
- T
Class Public methods
correct_for_windows_path(path) Link
Corrects path (usually returned by ‘Gem::URI.parse().path` on Windows), that comes with a leading slash.
glob_files_in_dir(glob, base_path) Link
Globs for files matching pattern inside of directory, returning absolute paths to the matching files.
gunzip(data) Link
Zlib::GzipReader wrapper that unzips data.
# File ruby/lib/rubygems/util.rb, line 12 def self.gunzip(data) require "zlib" require "stringio" data = StringIO.new(data, "r") gzip_reader = begin Zlib::GzipReader.new(data) rescue Zlib::GzipFile::Error => e raise e.class, e.inspect, e.backtrace end unzipped = gzip_reader.read unzipped.force_encoding Encoding::BINARY unzipped end
gzip(data) Link
Zlib::GzipWriter wrapper that zips data.
inflate(data) Link
A Zlib::Inflate#inflate wrapper
silent_system(*command) Link
Invokes system, but silences all output.
traverse_parents(directory, &block) Link
Enumerates the parents of directory.
# File ruby/lib/rubygems/util.rb, line 82 def self.traverse_parents(directory, &block) return enum_for __method__, directory unless block_given? here = File.expand_path directory loop do begin Dir.chdir here, &block rescue StandardError Errno::EACCES end new_here = File.expand_path("..", here) return if new_here == here # toplevel here = new_here end end