lib/sugar-high/file.rb in sugar-high-0.1.8 vs lib/sugar-high/file.rb in sugar-high-0.2.0
- old
+ new
@@ -1,7 +1,8 @@
require 'sugar-high/blank'
require 'sugar-high/arguments'
+require 'sugar-high/path'
class File
def self.delete! name
return nil if !File.exist?(name)
File.delete name
@@ -148,31 +149,5 @@
class Array
def file_names ext = '*'
self.map{|a| a.gsub( /(.*)\//, '').gsub(/\.#{Regexp.escape(ext)}/, '')}
end
end
-
-class String
- def path
- self.extend PathString
- end
-end
-
-module PathString
- def exists?
- File.exist? self
- end
-
- def up lv
- ('../' * lv) + 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
\ No newline at end of file