class NestedFile::PutDir
Attributes
mount_dir[RW]
parent_dir[RW]
relative_dir[RW]
Public Instance Methods
can_write?(path)
click to toggle source
# File lib/nested_file/put_dir.rb, line 83 def can_write?(path) true end
contents(path)
click to toggle source
# File lib/nested_file/put_dir.rb, line 34 def contents(path) log "contents for #{path}" do parent_path = mount_to_parent(path) res = Dir.entries(parent_path) res.map { |x| File.basename(x) } end end
directory?(path)
click to toggle source
# File lib/nested_file/put_dir.rb, line 44 def directory?(path) FileTest.directory? mount_to_parent(path) end
file?(path)
click to toggle source
# File lib/nested_file/put_dir.rb, line 41 def file?(path) FileTest.file? mount_to_parent(path) end
read_file(path)
click to toggle source
# File lib/nested_file/put_dir.rb, line 51 def read_file(path) log "read file #{path}" do read_file_inner path end end
read_file_inner(path)
click to toggle source
# File lib/nested_file/put_dir.rb, line 47 def read_file_inner(path) body = File.read(mount_to_parent(path)) PutFile.new(raw_body: body, filename: mount_to_parent(path), convert_path: relative_convert_path).parsed_body end
size(path)
click to toggle source
# File lib/nested_file/put_dir.rb, line 56 def size(path) log "size for #{path}" do read_file_inner(path).size end end