Files

PathString

Public Instance Methods

dir?() click to toggle source
# File lib/sugar-high/path.rb, line 16
def dir?  
  File.directory? self
end
down(lv) click to toggle source
# File lib/sugar-high/path.rb, line 42
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
exists?() click to toggle source
# File lib/sugar-high/path.rb, line 8
def exists?  
  File.exist? self
end
file?() click to toggle source
# File lib/sugar-high/path.rb, line 12
def file?  
  File.file? self
end
post_down(lv) click to toggle source
# File lib/sugar-high/path.rb, line 32
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
post_up(lv) click to toggle source
# File lib/sugar-high/path.rb, line 28
def post_up lv
  self + ('/..' * lv)
end
up(lv) click to toggle source
# File lib/sugar-high/path.rb, line 24
def up lv
  ('../' * lv) + self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.