[ruby/un] Use class methods of File
over Kernel.open
https://github.com/ruby/un/commit/13bdd766fe
This commit is contained in:
parent
e2b15461a7
commit
116920cff8
@ -256,7 +256,7 @@ def wait_writable
|
|||||||
wait = (wait = options[:w]) ? Float(wait) : 0.2
|
wait = (wait = options[:w]) ? Float(wait) : 0.2
|
||||||
argv.each do |file|
|
argv.each do |file|
|
||||||
begin
|
begin
|
||||||
open(file, "r+b")
|
File.open(file, "r+b")
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
break
|
break
|
||||||
rescue Errno::EACCES => e
|
rescue Errno::EACCES => e
|
||||||
@ -422,7 +422,7 @@ module UN # :nodoc:
|
|||||||
messages = {}
|
messages = {}
|
||||||
store = proc {|msg| messages[cmd] = msg}
|
store = proc {|msg| messages[cmd] = msg}
|
||||||
end
|
end
|
||||||
open(__FILE__) do |me|
|
File.open(__FILE__) do |me|
|
||||||
while me.gets("##\n")
|
while me.gets("##\n")
|
||||||
if help = me.gets("\n\n")
|
if help = me.gets("\n\n")
|
||||||
if all or argv.include?(cmd = help[/^#\s*ruby\s.*-e\s+(\w+)/, 1])
|
if all or argv.include?(cmd = help[/^#\s*ruby\s.*-e\s+(\w+)/, 1])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user