Sha256: c6ea3c75dd9142c3ee8a054cb7133667b388cedea612ad29e6e1df6c16b3bfe0
Contents?: true
Size: 721 Bytes
Versions: 8
Compression:
Stored size: 721 Bytes
Contents
class String def path self.extend PathString end end module PathString def exists? File.exist? self end def file? File.file? self end def dir? File.directory? self end def symlink? File.symlink? self end def up lv ('../' * lv) + self end def post_up lv self + ('/..' * lv) end def post_down lv up_dir = Regexp.escape('/..') orig = self.clone lv.times do self.gsub! /#{up_dir}$/, '' return self if self == orig end self end def down lv up_dir = Regexp.escape('../') orig = self.clone lv.times do self.gsub! /^#{up_dir}/, '' return self if self == orig end self end end
Version data entries
8 entries across 8 versions & 1 rubygems