@@ -1302,10 +1302,10 @@ def filter(input=nil, output=nil, **options)
13021302
13031303 #
13041304 # :call-seq:
1305- # foreach(filename_or_io , mode='r', **options) {|row| ... )
1306- # foreach(filename_or_io , mode='r', **options) -> new_enumerator
1305+ # foreach(path_or_io , mode='r', **options) {|row| ... )
1306+ # foreach(path_or_io , mode='r', **options) -> new_enumerator
13071307 #
1308- # Calls the block with each row read from source +filename_or_io +.
1308+ # Calls the block with each row read from source +path_or_io +.
13091309 #
13101310 # \Path input without headers:
13111311 #
@@ -1371,7 +1371,7 @@ def filter(input=nil, output=nil, **options)
13711371 # CSV.foreach(path) # => #<Enumerator: CSV:foreach("t.csv", "r")>
13721372 #
13731373 # Arguments:
1374- # * Argument +filename_or_io + must be a file path or an \IO stream.
1374+ # * Argument +path_or_io + must be a file path or an \IO stream.
13751375 # * Argument +mode+, if given, must be a \File mode.
13761376 # See {Access Modes}[https://docs.ruby-lang.org/en/master/File.html#class-File-label-Access+Modes].
13771377 # * Arguments <tt>**options</tt> must be keyword options.
@@ -1386,9 +1386,9 @@ def filter(input=nil, output=nil, **options)
13861386 # encoding: 'UTF-32BE:UTF-8'
13871387 # would read +UTF-32BE+ data from the file
13881388 # but transcode it to +UTF-8+ before parsing.
1389- def foreach ( filename_or_io , mode = "r" , **options , &block )
1390- return to_enum ( __method__ , filename_or_io , mode , **options ) unless block_given?
1391- open ( filename_or_io , mode , **options ) do |csv |
1389+ def foreach ( path_or_io , mode = "r" , **options , &block )
1390+ return to_enum ( __method__ , path_or_io , mode , **options ) unless block_given?
1391+ open ( path_or_io , mode , **options ) do |csv |
13921392 csv . each ( &block )
13931393 end
13941394 end
@@ -1565,8 +1565,8 @@ def generate_lines(rows, **options)
15651565
15661566 #
15671567 # :call-seq:
1568- # open(filename_or_io , mode = "rb", **options ) -> new_csv
1569- # open(filename_or_io , mode = "rb", **options ) { |csv| ... } -> object
1568+ # open(path_or_io , mode = "rb", **options ) -> new_csv
1569+ # open(path_or_io , mode = "rb", **options ) { |csv| ... } -> object
15701570 #
15711571 # possible options elements:
15721572 # keyword form:
@@ -1575,14 +1575,14 @@ def generate_lines(rows, **options)
15751575 # :undef => :replace # replace undefined conversion
15761576 # :replace => string # replacement string ("?" or "\uFFFD" if not specified)
15771577 #
1578- # * Argument +filename_or_io +, must be a file path or an \IO stream.
1578+ # * Argument +path_or_io +, must be a file path or an \IO stream.
15791579 # :include: ../doc/csv/arguments/io.rdoc
15801580 # * Argument +mode+, if given, must be a \File mode.
15811581 # See {Access Modes}[https://docs.ruby-lang.org/en/master/File.html#class-File-label-Access+Modes].
15821582 # * Arguments <tt>**options</tt> must be keyword options.
15831583 # See {Options for Generating}[#class-CSV-label-Options+for+Generating].
15841584 # * This method optionally accepts an additional <tt>:encoding</tt> option
1585- # that you can use to specify the Encoding of the data read from +filename_or_io +.
1585+ # that you can use to specify the Encoding of the data read from +path_or_io +.
15861586 # You must provide this unless your data is in the encoding
15871587 # given by <tt>Encoding::default_external</tt>.
15881588 # Parsing will use this to determine how to parse the data.
@@ -1644,11 +1644,11 @@ def generate_lines(rows, **options)
16441644 # Raises an exception if the argument is not a \String object or \IO object:
16451645 # # Raises TypeError (no implicit conversion of Symbol into String)
16461646 # CSV.open(:foo)
1647- def open ( filename_or_io , mode = "r" , **options )
1647+ def open ( path_or_io , mode = "r" , **options )
16481648 # wrap a File opened with the remaining +args+ with no newline
16491649 # decorator
16501650 file_opts = { }
1651- may_enable_bom_detection_automatically ( filename_or_io ,
1651+ may_enable_bom_detection_automatically ( path_or_io ,
16521652 mode ,
16531653 options ,
16541654 file_opts )
@@ -1661,11 +1661,11 @@ def open(filename_or_io, mode="r", **options)
16611661 options . delete ( :replace )
16621662 options . delete_if { |k , _ | /newline\z / . match? ( k ) }
16631663
1664- if filename_or_io . is_a? ( StringIO )
1665- f = create_stringio ( filename_or_io . string , mode , **file_opts )
1664+ if path_or_io . is_a? ( StringIO )
1665+ f = create_stringio ( path_or_io . string , mode , **file_opts )
16661666 else
16671667 begin
1668- f = File . open ( filename_or_io , mode , **file_opts )
1668+ f = File . open ( path_or_io , mode , **file_opts )
16691669 rescue ArgumentError => e
16701670 raise unless /needs binmode/ . match? ( e . message ) and mode == "r"
16711671 mode = "rb"
@@ -1919,16 +1919,16 @@ def parse_line(line, **options)
19191919 # path = 't.csv'
19201920 # File.write(path, string)
19211921 # CSV.read(path, headers: true) # => #<CSV::Table mode:col_or_row row_count:4>
1922- def read ( filename_or_io , **options )
1923- open ( filename_or_io , **options ) { |csv | csv . read }
1922+ def read ( path_or_io , **options )
1923+ open ( path_or_io , **options ) { |csv | csv . read }
19241924 end
19251925
19261926 # :call-seq:
19271927 # CSV.readlines(source, **options)
19281928 #
19291929 # Alias for CSV.read.
1930- def readlines ( filename_or_io , **options )
1931- read ( filename_or_io , **options )
1930+ def readlines ( path_or_io , **options )
1931+ read ( path_or_io , **options )
19321932 end
19331933
19341934 # :call-seq:
@@ -1946,25 +1946,25 @@ def readlines(filename_or_io, **options)
19461946 # path = 't.csv'
19471947 # File.write(path, string)
19481948 # CSV.table(path) # => #<CSV::Table mode:col_or_row row_count:4>
1949- def table ( filename_or_io , **options )
1949+ def table ( path_or_io , **options )
19501950 default_options = {
19511951 headers : true ,
19521952 converters : :numeric ,
19531953 header_converters : :symbol ,
19541954 }
19551955 options = default_options . merge ( options )
1956- read ( filename_or_io , **options )
1956+ read ( path_or_io , **options )
19571957 end
19581958
19591959 ON_WINDOWS = /mingw|mswin/ . match? ( RUBY_PLATFORM )
19601960 private_constant :ON_WINDOWS
19611961
19621962 private
1963- def may_enable_bom_detection_automatically ( filename_or_io ,
1963+ def may_enable_bom_detection_automatically ( path_or_io ,
19641964 mode ,
19651965 options ,
19661966 file_opts )
1967- if filename_or_io . is_a? ( StringIO )
1967+ if path_or_io . is_a? ( StringIO )
19681968 # Support to StringIO was dropped for Ruby 2.6 and earlier without BOM support:
19691969 # https://github.com/ruby/stringio/pull/47
19701970 return if RUBY_VERSION < "2.7"
0 commit comments