lib/vfs/entries/file.rb in vfs-0.4.8 vs lib/vfs/entries/file.rb in vfs-0.5.0

- old
+ new

@@ -1,16 +1,12 @@ module Vfs class File < Entry - # - # Attributes - # + # Attributes. alias_method :exist?, :file? + # CRUD. - # - # CRUD - # def read options = {}, &block options[:bang] = true unless options.include? :bang driver.open do begin if block @@ -68,11 +64,11 @@ driver.write_file(path, options[:append]){|writer| writer.write data} end rescue StandardError => error parent = self.parent if entry.exist? - entry.destroy + entry.delete elsif !parent.exist? parent.create(options) else # unknown error raise error @@ -93,18 +89,16 @@ def update options = {}, &block data = read options write block.call(data), options end - def destroy - destroy_entry + def delete + delete_entry end + # Transfers. - # - # Transfers - # def copy_to to, options = {} raise Error, "you can't copy to itself" if self == to target = if to.is_a? File to @@ -123,17 +117,15 @@ target end def move_to to copy_to to - destroy + delete to end + # Extra Stuff. - # - # Extra Stuff - # def render *args require 'tilt' args.unshift Object.new if args.size == 1 and args.first.is_a?(Hash) \ No newline at end of file