Sha256: 19e85c04e3d86a42d8e60048f68a9f042e4cf84d69e0fd1f6feedfe00249e88f
Contents?: true
Size: 937 Bytes
Versions: 40
Compression:
Stored size: 937 Bytes
Contents
require "pathname" module Juicer module Command # Utilities for Juicer command objects # module Util # Returns an array of files from a variety of input. Input may be a single # file, a single glob pattern or multiple files and/or patterns. It may # even be an array of mixed input. # def files(*args) args.flatten.collect { |file| Dir.glob(file) }.flatten end # # Uses Pathname to calculate the shortest relative path from +path+ to # +reference_path+ (default is +Dir.cwd+) # def relative(paths, reference_path = Dir.pwd) paths = [paths].flatten.collect do |path| path = Pathname.new(File.expand_path(path)) reference_path = Pathname.new(File.expand_path(reference_path)) path.relative_path_from(reference_path).to_s end paths.length == 1 ? paths.first : paths end end end end
Version data entries
40 entries across 40 versions & 4 rubygems