Sha256: bd6cd950b14f0e02941bc97fb9ef039dc3f5c34ba0eb644aa77899bc06cdcc11
Contents?: true
Size: 565 Bytes
Versions: 2
Compression:
Stored size: 565 Bytes
Contents
# encoding: utf-8 module Rubocop # Common methods and behaviors for dealing with paths. module PathUtil module_function def relative_path(path, base_dir = Dir.pwd) path_name = Pathname.new(File.expand_path(path)) path_name.relative_path_from(Pathname.new(base_dir)).to_s end def match_path?(pattern, path) case pattern when String basename = File.basename(path) path == pattern || basename == pattern || File.fnmatch(pattern, path) when Regexp path =~ pattern end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.20.1 | lib/rubocop/path_util.rb |
rubocop-0.20.0 | lib/rubocop/path_util.rb |