module PathMapper::Helper::Storage

Public Instance Methods

delete_storage_branch(pathname) click to toggle source
# File lib/path_mapper/helper/storage.rb, line 30
def delete_storage_branch(pathname)
  self.storage_file_delete(pathname)
  self.storage.select {|k,v| k.to_s.start_with? pathname.to_s }.each {|k,v| self.storage_file_delete(k) }
end
deleted_files() click to toggle source
# File lib/path_mapper/helper/storage.rb, line 8
def deleted_files
  self.storage[:deleted_files] ||= []
end
storage() click to toggle source
# File lib/path_mapper/helper/storage.rb, line 4
def storage
  Thread.current[:dry_storage] ||= {}
end
storage_file_delete(pathname) click to toggle source
# File lib/path_mapper/helper/storage.rb, line 25
def storage_file_delete(pathname)
  self.deleted_files << pathname
  self.storage.delete(pathname)
end
storage_file_tree(pathname) click to toggle source
# File lib/path_mapper/helper/storage.rb, line 20
def storage_file_tree(pathname)
  self.storage[pathname] = File.read(pathname)
  storage_tree(pathname.parent)
end
storage_tree(pathname) click to toggle source
# File lib/path_mapper/helper/storage.rb, line 12
def storage_tree(pathname)
  path = pathname
  while path.to_s != '/'
    self.storage[path] = nil
    path = path.parent
  end
end