Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby27
/
share
/
ri
/
system
/
CSV
/
//opt/alt/ruby27/share/ri/system/CSV/new-c.ri
U:RDoc::AnyMethod[iI"new:ETI" CSV::new;TT:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"RThis constructor will wrap either a String or IO object passed in +data+ for ;TI"Qreading and/or writing. In addition to the CSV instance methods, several IO ;TI"Omethods are delegated. (See CSV::open() for a complete list.) If you pass ;TI"Na String for +data+, you can later retrieve it (after writing to it, for ;TI" example) with CSV.string().;To:RDoc::Markup::BlankLine o; ; [I"INote that a wrapped String will be positioned at the beginning (for ;TI"Mreading). If you want it at the end (for writing), use CSV::generate(). ;TI"NIf you want any other positioning, pass a preset StringIO object instead.;T@o; ; [I"OYou may set any reading and/or writing preferences in the +options+ Hash. ;TI"Available options are:;T@o:RDoc::Markup::List: @type: NOTE:@items[o:RDoc::Markup::ListItem:@label[I"<b><tt>:col_sep</tt></b>;T; [o; ; [I"+The String placed between each field. ;TI")This String will be transcoded into ;TI"(the data's Encoding before parsing.;To;;[I"<b><tt>:row_sep</tt></b>;T; [o; ; ["I",The String appended to the end of each ;TI")row. This can be set to the special ;TI",<tt>:auto</tt> setting, which requests ;TI"*that CSV automatically discover this ;TI")from the data. Auto-discovery reads ;TI",ahead in the data looking for the next ;TI"(<tt>"\r\n"</tt>, <tt>"\n"</tt>, or ;TI"(<tt>"\r"</tt> sequence. A sequence ;TI"+will be selected even if it occurs in ;TI"'a quoted field, assuming that you ;TI"&would have the same line endings ;TI"*there. If none of those sequences is ;TI"%found, +data+ is <tt>ARGF</tt>, ;TI")<tt>STDIN</tt>, <tt>STDOUT</tt>, or ;TI",<tt>STDERR</tt>, or the stream is only ;TI"'available for output, the default ;TI"&<tt>$INPUT_RECORD_SEPARATOR</tt> ;TI"'(<tt>$/</tt>) is used. Obviously, ;TI"(discovery takes a little time. Set ;TI"*manually if speed is important. Also ;TI"+note that IO objects should be opened ;TI"'in binary mode on Windows if this ;TI"!feature will be used as the ;TI"'line-ending translation can cause ;TI"*problems with resetting the document ;TI")position to where it was before the ;TI"%read ahead. This String will be ;TI")transcoded into the data's Encoding ;TI"before parsing.;To;;[I" <b><tt>:quote_char</tt></b>;T; [o; ; [I")The character used to quote fields. ;TI"'This has to be a single character ;TI" String. This is useful for ;TI"&application that incorrectly use ;TI"'<tt>'</tt> as the quote character ;TI"(instead of the correct <tt>"</tt>. ;TI"'CSV will always consider a double ;TI")sequence of this character to be an ;TI"(escaped quote. This String will be ;TI")transcoded into the data's Encoding ;TI"before parsing.;To;;[I"&<b><tt>:field_size_limit</tt></b>;T; [o; ; [I"*This is a maximum size CSV will read ;TI")ahead looking for the closing quote ;TI")for a field. (In truth, it reads to ;TI"'the first line ending beyond this ;TI"'size.) If a quote cannot be found ;TI"'within the limit CSV will raise a ;TI"*MalformedCSVError, assuming the data ;TI"*is faulty. You can use this limit to ;TI"&prevent what are effectively DoS ;TI"*attacks on the parser. However, this ;TI"+limit can cause a legitimate parse to ;TI",fail and thus is set to +nil+, or off, ;TI"by default.;To;;[I" <b><tt>:converters</tt></b>;T; [o; ; [I"+An Array of names from the Converters ;TI",Hash and/or lambdas that handle custom ;TI"$conversion. A single converter ;TI")doesn't have to be in an Array. All ;TI"*built-in converters try to transcode ;TI"(fields to UTF-8 before converting. ;TI"*The conversion will fail if the data ;TI"'cannot be transcoded, leaving the ;TI"field unchanged.;To;;[I"(<b><tt>:unconverted_fields</tt></b>;T; [o; ; [I"If set to +true+, an ;TI")unconverted_fields() method will be ;TI"*added to all returned rows (Array or ;TI"+CSV::Row) that will return the fields ;TI"*as they were before conversion. Note ;TI"(that <tt>:headers</tt> supplied by ;TI",Array or String were not fields of the ;TI"*document and thus will have an empty ;TI"Array attached.;To;;[I"<b><tt>:headers</tt></b>;T; [o; ; [I"&If set to <tt>:first_row</tt> or ;TI"(+true+, the initial row of the CSV ;TI"&file will be treated as a row of ;TI"&headers. If set to an Array, the ;TI"+contents will be used as the headers. ;TI"+If set to a String, the String is run ;TI")through a call of CSV::parse_line() ;TI"&with the same <tt>:col_sep</tt>, ;TI"<tt>:row_sep</tt>, and ;TI"+<tt>:quote_char</tt> as this instance ;TI"*to produce an Array of headers. This ;TI"*setting causes CSV#shift() to return ;TI")rows as CSV::Row objects instead of ;TI"%Arrays and CSV#read() to return ;TI",CSV::Table objects instead of an Array ;TI"of Arrays.;To;;[I"$<b><tt>:return_headers</tt></b>;T; [o; ; [I",When +false+, header rows are silently ;TI")swallowed. If set to +true+, header ;TI",rows are returned in a CSV::Row object ;TI" with identical headers and ;TI",fields (save that the fields do not go ;TI"through the converters).;To;;[I"#<b><tt>:write_headers</tt></b>;T; [o; ; [I"*When +true+ and <tt>:headers</tt> is ;TI",set, a header row will be added to the ;TI"output.;To;;[I"'<b><tt>:header_converters</tt></b>;T; [o; ; [ I"#Identical in functionality to ;TI"(<tt>:converters</tt> save that the ;TI")conversions are only made to header ;TI"*rows. All built-in converters try to ;TI"'transcode headers to UTF-8 before ;TI"*converting. The conversion will fail ;TI"'if the data cannot be transcoded, ;TI""leaving the header unchanged.;To;;[I"!<b><tt>:skip_blanks</tt></b>;T; [o; ; [I"+When setting a +true+ value, CSV will ;TI")skip over any empty rows. Note that ;TI"*this setting will not skip rows that ;TI"(contain column separators, even if ;TI")the rows contain no actual data. If ;TI"(you want to skip rows that contain ;TI")separators but no content, consider ;TI"$using <tt>:skip_lines</tt>, or ;TI")inspecting fields.compact.empty? on ;TI"each row.;To;;[I""<b><tt>:force_quotes</tt></b>;T; [o; ; [I"+When setting a +true+ value, CSV will ;TI"%quote all CSV fields it creates.;To;;[I" <b><tt>:skip_lines</tt></b>;T; [o; ; [I"*When setting an object responding to ;TI")<tt>match</tt>, every line matching ;TI",it is considered a comment and ignored ;TI"+during parsing. When set to a String, ;TI"(it is first converted to a Regexp. ;TI"-When set to +nil+ no line is considered ;TI"*a comment. If the passed object does ;TI"$not respond to <tt>match</tt>, ;TI"&<tt>ArgumentError</tt> is thrown.;To;;[I"%<b><tt>:liberal_parsing</tt></b>;T; [o; ; [ I"+When setting a +true+ value, CSV will ;TI"+attempt to parse input not conformant ;TI"*with RFC 4180, such as double quotes ;TI"in unquoted fields.;To;;[I"<b><tt>:nil_value</tt></b>;T; [o; ; [I"*When set an object, any values of an ;TI"(empty field is replaced by the set ;TI"object, not nil.;To;;[I"!<b><tt>:empty_value</tt></b>;T; [o; ; [I"-When setting an object, any values of a ;TI"'blank string field is replaced by ;TI"the set object.;To;;[I"!<b><tt>:quote_empty</tt></b>;T; [o; ; [ I"+When setting a +true+ value, CSV will ;TI",quote empty values with double quotes. ;TI"$When +false+, CSV will emit an ;TI"+empty string for an empty field value.;To;;[I"&<b><tt>:write_converters</tt></b>;T; [o; ; [I"+Converts values on each line with the ;TI"(specified <tt>Proc</tt> object(s), ;TI"+which receive a <tt>String</tt> value ;TI"+and return a <tt>String</tt> or +nil+ ;TI"value. ;TI"&When an array is specified, each ;TI"(converter will be applied in order.;To;;[I"%<b><tt>:write_nil_value</tt></b>;T; [o; ; [I")When a <tt>String</tt> value, +nil+ ;TI",value(s) on each line will be replaced ;TI"with the specified value.;To;;[I"'<b><tt>:write_empty_value</tt></b>;T; [o; ; [I",When a <tt>String</tt> or +nil+ value, ;TI")empty value(s) on each line will be ;TI"'replaced with the specified value.;To;;[I"<b><tt>:strip</tt></b>;T; [o; ; [ I"+When setting a +true+ value, CSV will ;TI"+strip "\t\r\n\f\v" around the values. ;TI"(If you specify a string instead of ;TI"(+true+, CSV will strip string. The ;TI"$length of the string must be 1.;T@o; ; [I"7See CSV::DEFAULT_OPTIONS for the default settings.;T@o; ; [I"SOptions cannot be overridden in the instance methods for performance reasons, ;TI"*so be sure to set what you want here.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[ I"�(data, col_sep: ",", row_sep: :auto, quote_char: '"', field_size_limit: nil, converters: nil, unconverted_fields: nil, headers: false, return_headers: false, write_headers: nil, header_converters: nil, skip_blanks: false, force_quotes: false, skip_lines: nil, liberal_parsing: false, internal_encoding: nil, external_encoding: nil, encoding: nil, nil_value: nil, empty_value: "", quote_empty: true, write_converters: nil, write_nil_value: nil, write_empty_value: "", strip: false);T@>FI"CSV;TcRDoc::NormalClass00