lib/sugar-high/file.rb in sugar-high-0.1.7 vs lib/sugar-high/file.rb in sugar-high-0.1.8
- old
+ new
@@ -74,11 +74,11 @@
end
# TODO: Needs spec
# insert_into 'my_file.txt', :after => 'Blip', :content => 'Hello
- # insert_into 'my_file.txt', :after => 'Blip', 'Hello
+ # insert_into 'my_file.txt', 'Hello', :after => 'Blip'
# insert_into 'my_file.txt', :after => 'Blip' do
# 'Hello'
# end
def self.insert_into file_name, *args, &block
@@ -152,13 +152,17 @@
end
class String
def path
self.extend PathString
- end
+ end
end
module PathString
+ def exists?
+ File.exist? self
+ end
+
def up lv
('../' * lv) + self
end
def down lv
\ No newline at end of file