Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ruby / usr / share / ri / 2.2.0 / system / CSV / new-c.ri
Size: Mime:
U:RDoc::AnyMethod[iI"new:ETI"
CSV::new;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[
I"RThis constructor will wrap either a String or IO object passed in +data+ for ;TI"Rreading and/or writing.  In addition to the CSV instance methods, several IO ;TI"Qmethods 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::BlankLineo;
;	[I"LNote that a wrapped String will be positioned at at the beginning (for ;TI"Nreading).  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 set to 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 set to a +true+ value, CSV will ;TI"%quote all CSV fields it creates.;To;;[I" <b><tt>:skip_lines</tt></b>;T;	[o;
;	[I")When set to 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.;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, options = Hash.new);T@îFI"CSV;TcRDoc::NormalClass00