Method: Dry::Files::MemoryFileSystem#touch
- Defined in:
- lib/dry/files/memory_file_system.rb
#touch(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a file, if it doesn't exist, and set empty content.
If the file was already existing, it's a no-op.
101 102 103 104 105 106 107 |
# File 'lib/dry/files/memory_file_system.rb', line 101 def touch(path) path = Path[path] raise IOError, Errno::EISDIR.new(path.to_s) if directory?(path) content = read(path) if exist?(path) write(path, content || EMPTY_CONTENT) end |