Skip to content

Commit c820afd

Browse files
committed
Use File.sysopen for consistency
* There is no point to call IO.sysopen and that's the last IO method, with Pathname we know it's always a file path.
1 parent 03c20fb commit c820afd

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/pathname.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ module ::Kernel
150150
# - #read(*args)
151151
# - #binread(*args)
152152
# - #readlines(*args)
153+
# - #sysopen(*args)
153154
# - #write(*args)
154155
# - #binwrite(*args)
155156
# - #atime
@@ -190,11 +191,6 @@ module ::Kernel
190191
# - #mkdir(*args)
191192
# - #opendir(*args)
192193
#
193-
# === IO
194-
#
195-
# This method is a facade for IO:
196-
# - #sysopen(*args)
197-
#
198194
# === Utilities
199195
#
200196
# These methods are a mixture of Find, FileUtils, and others:
@@ -856,11 +852,6 @@ def relative_path_from(base_directory)
856852
end
857853
end
858854

859-
class Pathname # * IO *
860-
# See <tt>IO.sysopen</tt>.
861-
def sysopen(...) IO.sysopen(@path, ...) end
862-
end
863-
864855
class Pathname # * File *
865856
#
866857
# #each_line iterates over the line in the file. It yields a String object
@@ -883,6 +874,9 @@ def binread(...) File.binread(@path, ...) end
883874
# See <tt>File.readlines</tt>. Returns all the lines from the file.
884875
def readlines(...) File.readlines(@path, ...) end
885876

877+
# See <tt>File.sysopen</tt>.
878+
def sysopen(...) File.sysopen(@path, ...) end
879+
886880
# Writes +contents+ to the file. See <tt>File.write</tt>.
887881
def write(...) File.write(@path, ...) end
888882

0 commit comments

Comments
 (0)