Pathname has an #mkdir method to create a directory at the path, but does not have a #touch method to create an empty file at that path.
There were numerous cases where I had to fallback to using
new_file = Pathname.new('location/for/new/file')
instead of simply being able to use:
I would like to add this method. If you like it, let me know. I will provide a patch then.
- Assignee set to Akira Tanaka
- Target version set to next minor
- Status changed from Open to Assigned
I'm a little surprise there isn't an option for this in
FileUtils. Something like
FileUtils.touch('/location/for/new', :force => true). I'd be in favor of adding that, or an option to
Any update on this
"#mkpath" almost works but doesn't have the mtime option
- Status changed from Assigned to Rejected
I don't like the method name "touch".
"touch" command has multiple features:
create empty file, update mtime.
So, the intent of touch method is ambiguous.
Also available in: Atom