# File lib/fog/local/models/storage/files.rb, line 14 def all requires :directory if directory.collection.get(directory.key) pwd = Dir.pwd Dir.chdir(service.path_to(directory.key)) data = Dir.glob('**/*').reject do |file| ::File.directory?(file) end.map do |key| path = file_path(key) { :content_length => ::File.size(path), :key => key, :last_modified => ::File.mtime(path) } end Dir.chdir(pwd) load(data) else nil end end
# File lib/fog/local/models/storage/files.rb, line 36 def get(key, &block) requires :directory path = file_path(key) if ::File.exists?(path) data = { :content_length => ::File.size(path), :key => key, :last_modified => ::File.mtime(path) } if block_given? file = ::File.open(path) while (chunk = file.read(Excon::CHUNK_SIZE)) && yield(chunk); end file.close new(data) else body = ::File.read(path) new(data.merge!(:body => body)) end else nil end end
Generated with the Darkfish Rdoc Generator 2.