# File lib/sugar-high/path.rb, line 39 def dir? File.directory? self end
# File lib/sugar-high/path.rb, line 54 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
# File lib/sugar-high/path.rb, line 29 def exists? File.exist? self end
# File lib/sugar-high/path.rb, line 34 def file? File.file? self end
# File lib/sugar-high/path.rb, line 68 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
# File lib/sugar-high/path.rb, line 64 def post_up lv self + ('/..' * lv) end
# File lib/sugar-high/path.rb, line 45 def symlink? File.symlink? self end
# File lib/sugar-high/path.rb, line 15 def to_dir option=nil raise ArgumentError, "Dir doesn't exist" if option == :raise && !File.directory?(self) Dir.new(self) if File.directory? self end
# File lib/sugar-high/path.rb, line 8 def to_file option=nil raise ArgumentError, "File doesn't exist" if option == :raise && !File.directory?(self) File.new(self) if File.file? self end
# File lib/sugar-high/path.rb, line 22 def to_symlink new_path #, option=nil # raise ArgumentError, "New link location doesn't exist" if option == :raise && !File.exist?(new_path) File.symlink(self, new_path) end
Generated with the Darkfish Rdoc Generator 2.