[#76442] [Ruby trunk Feature#11741] Migrate Ruby to Git from Subversion — naruse@...
Issue #11741 has been updated by Yui NARUSE.
3 messages
2016/07/19
[#76515] [Ruby trunk Bug#12610] webrick: protect from httpoxy — nagachika00@...
Issue #12610 has been updated by Tomoyuki Chikanaga.
3 messages
2016/07/22
[ruby-core:76451] [Ruby trunk Feature#7361] Adding Pathname#touch
From:
najamelan@...
Date:
2016-07-19 19:25:04 UTC
List:
ruby-core #76451
Issue #7361 has been updated by Naja Melan.
I prefer something like (warning, untested code):
~~~ ruby
def touch( subPath = '', **options )
path = @path
ret = self
if directory?
ret = join subPath
path = ret.to_path
end
FileUtils.touch( path, **options )
ret
end
~~~
lets you do:
~~~ ruby
mydir.touch 'somefile'
~~~
I think touch is a good name because everybody already knows it and it's what people will try out spontaneously before even looking in the docs why it doesn't work. Joel Spolsky [explains quite well](http://www.joelonsoftware.com/uibook/fog0000000249.html) why this is a good thing.
----------------------------------------
Feature #7361: Adding Pathname#touch
https://bugs.ruby-lang.org/issues/7361#change-59696
* Author: Alexander E. Fischer
* Status: Rejected
* Priority: Normal
* Assignee: Akira Tanaka
----------------------------------------
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')
FileUtils.touch(new_file)
instead of simply being able to use:
new_file.touch
I would like to add this method. If you like it, let me know. I will provide a patch then.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>