ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- instance-c.ri000064400000001317152402455720007134 0ustar00U:RDoc::AnyMethod[iI" instance:EFI"CSV::instance;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"KThis method will return a CSV instance, just like CSV::new(), but the ;TI"Rinstance will be cached and returned for all future calls to this method for ;TI"Ithe same +data+ object (tested by Object#object_id()) with the same ;TI"+options+.;To:RDoc::Markup::BlankLineo; ; [I"MIf a block is given, the instance is passed to the block and the return ;TI"1value becomes the return value of the block.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below00I" instance;T[I")(data = $stdout, options = Hash.new);T@FI"CSV;TcRDoc::NormalClass00escape_re-i.ri000064400000001167152402455720007267 0ustar00U:RDoc::AnyMethod[iI"escape_re:EFI"CSV#escape_re;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"RThis method is an encoding safe version of Regexp::escape(). It will escape ;TI"Qany characters that would change the meaning of a regular expression in the ;TI"Qencoding of +str+. Regular expression characters that cannot be transcoded ;TI"Qto the target encoding will be skipped and no escaping will be performed if ;TI"&a backslash cannot be transcoded.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (str);T@FI"CSV;TcRDoc::NormalClass00write_headers%3f-i.ri000064400000000531152402455720010456 0ustar00U:RDoc::AnyMethod[iI"write_headers?:EFI"CSV#write_headers?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OReturns +true+ if headers are written in output. See CSV::new for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00encode_re-i.ri000064400000000571152402455720007262 0ustar00U:RDoc::AnyMethod[iI"encode_re:EFI"CSV#encode_re;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NBuilds a regular expression in @encoding. All +chunks+ will be ;TI"!transcoded to that encoding.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(*chunks);T@FI"CSV;TcRDoc::NormalClass00readline-i.ri000064400000000355152402455720007122 0ustar00U:RDoc::AnyMethod[iI" readline:ETI"CSV#readline;TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CSV;TcRDoc::NormalClass0[@FI" shift;Fheader_row%3f-i.ri000064400000000502152402455720007746 0ustar00U:RDoc::AnyMethod[iI"header_row?:EFI"CSV#header_row?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Returns +true+ if the next row read will be a header row.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00inspect-i.ri000064400000000541152402455720007001 0ustar00U:RDoc::AnyMethod[iI" inspect:EFI"CSV#inspect;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FReturns a simplified description of the key CSV attributes in an ;TI"ASCII compatible String.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00shift-i.ri000064400000001156152402455720006454 0ustar00U:RDoc::AnyMethod[iI" shift:EFI"CSV#shift;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QThe primary read method for wrapped Strings and IOs, a single row is pulled ;TI"Pfrom the data source, parsed and returned as an Array of fields (if header ;TI"Brows are not used) or a CSV::Row (when header rows are used).;To:RDoc::Markup::BlankLineo; ; [I".The data source must be open for reading.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I" gets;To;; [; @; 0[I" readline;To;; [; @; 0I"();T@FI"CSV;TcRDoc::NormalClass00init_comments-i.ri000064400000001016152402455720010202 0ustar00U:RDoc::AnyMethod[iI"init_comments:EFI"CSV#init_comments;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"FStores the pattern of comments to skip from the provided options.;To:RDoc::Markup::BlankLineo; ; [I"IThe pattern must respond to +.match+, else ArgumentError is raised. ;TI"'Strings are converted to a Regexp.;T@o; ; [I"See also CSV.new;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(options);T@FI"CSV;TcRDoc::NormalClass00header_converters-i.ri000064400000000717152402455720011043 0ustar00U:RDoc::AnyMethod[iI"header_converters:EFI"CSV#header_converters;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QReturns the current list of converters in effect for headers. See CSV::new ;TI"Nfor details. Built-in converters will be returned by name, while others ;TI"will be returned as is.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00read-c.ri000064400000001650152402455720006243 0ustar00U:RDoc::AnyMethod[iI" read:EFI"CSV::read;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NUse to slurp a CSV file into an Array of Arrays. Pass the +path+ to the ;TI"Rfile and any +options+ CSV::new() understands. This method also understands ;TI"Pan additional :encoding parameter that you can use to specify the ;TI"OEncoding of the data in the file to be read. You must provide this unless ;TI"Syour data is in Encoding::default_external(). CSV will use this to determine ;TI"Phow to parse the data. You may provide a second Encoding to have the data ;TI"-transcoded as it is read. For example, ;TI"Pencoding: "UTF-32BE:UTF-8" would read UTF-32BE data from the file ;TI"4but transcode it to UTF-8 before CSV parses it.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(path, *options);T@FI"CSV;TcRDoc::NormalClass00encoding-i.ri000064400000000613152402455720007122 0ustar00U:RDoc::Attr[iI" encoding:ETI"CSV#encoding;TI"R;T: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OThe Encoding CSV is parsing or writing in. This will be the Encoding you ;TI"Hreceive parsed data in and/or the Encoding data will be written in.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0F@I"CSV;TcRDoc::NormalClass0skip_lines-i.ri000064400000000472152402455720007477 0ustar00U:RDoc::Attr[iI"skip_lines:ETI"CSV#skip_lines;TI"R;T: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DThe regex marking a line as a comment. See CSV::new for details;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0F@I"CSV;TcRDoc::NormalClass0new-c.ri000064400000015455152402455720006131 0ustar00U: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":col_sep;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":row_sep;T; [o; ; ["I",The String appended to the end of each ;TI"*row. This can be set to the special ;TI",:auto 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"("\r\n", "\n", or ;TI")"\r" 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 ARGF, ;TI")STDIN, STDOUT, or ;TI",STDERR, or the stream is only ;TI"'available for output, the default ;TI"&$INPUT_RECORD_SEPARATOR ;TI"(($/) 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" :quote_char;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"'' as the quote character ;TI"(instead of the correct ". ;TI"'CSV will always consider a double ;TI"&sequence this character to be an ;TI"(escaped quote. This String will be ;TI")transcoded into the data's Encoding ;TI"before parsing.;To;;[I"&:field_size_limit;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" :converters;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"(:unconverted_fields;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 :headers supplied by ;TI",Array or String were not fields of the ;TI"*document and thus will have an empty ;TI"Array attached.;To;;[I":headers;T; [o; ; [I"&If set to :first_row 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 :col_sep, ;TI":row_sep, and ;TI"+:quote_char 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"$:return_headers;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"#:write_headers;T; [o; ; [I"*When +true+ and :headers is ;TI",set, a header row will be added to the ;TI" output.;To;;[I"':header_converters;T; [o; ; [ I"#Identical in functionality to ;TI"(:converters 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"!:skip_blanks;T; [o; ; [I"*When set to a +true+ value, CSV will ;TI"(skip over any rows with no content.;To;;[I"":force_quotes;T; [o; ; [I"*When set to a +true+ value, CSV will ;TI"%quote all CSV fields it creates.;To;;[I" :skip_lines;T; [o; ; [I")When set to an object responding to ;TI")match, 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 match, ;TI"&ArgumentError 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::NormalClass00return_headers%3f-i.ri000064400000000561152402455720010646 0ustar00U:RDoc::AnyMethod[iI"return_headers?:EFI"CSV#return_headers?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EReturns +true+ if headers will be returned as a row of results. ;TI"See CSV::new for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00parse-c.ri000064400000001351152402455720006440 0ustar00U:RDoc::AnyMethod[iI" parse:EFI"CSV::parse;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RThis method can be used to easily parse CSV out of a String. You may either ;TI"Qprovide a +block+ which will be called with each row of the String in turn, ;TI"Ior just use the returned Array of Arrays (when no +block+ is given).;To:RDoc::Markup::BlankLineo; ; [I"QYou pass your +str+ to read from, and an optional +options+ Hash containing ;TI"%anything CSV::new() understands.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"Uparse( str, options = Hash.new ) { |row| ... } parse( str, options = Hash.new ) ;T0[I"(*args, &block);T@FI"CSV;TcRDoc::NormalClass00puts-i.ri000064400000000345152402455720006331 0ustar00U:RDoc::AnyMethod[iI" puts:ETI" CSV#puts;TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (row);T@ FI"CSV;TcRDoc::NormalClass0[@FI"<<;Tencode_str-i.ri000064400000000557152402455720007470 0ustar00U:RDoc::AnyMethod[iI"encode_str:EFI"CSV#encode_str;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PBuilds a String in @encoding. All +chunks+ will be transcoded to ;TI"that encoding.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(*chunks);T@FI"CSV;TcRDoc::NormalClass00add_converter-i.ri000064400000001257152402455720010160 0ustar00U:RDoc::AnyMethod[iI"add_converter:EFI"CSV#add_converter;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RThe actual work method for adding converters, used by both CSV.convert() and ;TI"CSV.header_convert().;To:RDoc::Markup::BlankLineo; ; [I"OThis method requires the +var_name+ of the instance variable to place the ;TI"Lconverters in, the +const+ Hash to lookup named converters in, and the ;TI"Mnormal parameters of the CSV.convert() and CSV.header_convert() methods.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I".(var_name, const, name = nil, &converter);T@FI"CSV;TcRDoc::NormalClass00filter-c.ri000064400000002642152402455720006617 0ustar00U:RDoc::AnyMethod[iI" filter:EFI"CSV::filter;TT: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OThis method is a convenience for building Unix-like filters for CSV data. ;TI"MEach row is yielded to the provided block which can alter it as needed. ;TI"MAfter the block returns, the row is appended to +output+ altered or not.;To:RDoc::Markup::BlankLineo; ; [I"KThe +input+ and +output+ arguments can be anything CSV::new() accepts ;TI"F(generally String or IO objects). If not given, they default to ;TI"(ARGF and $stdout.;T@o; ; [ I"LThe +options+ parameter is also filtered down to CSV::new() after some ;TI"Bclever key parsing. Any key beginning with :in_ or ;TI"O:input_ will have that leading identifier stripped and will only ;TI"Obe used in the +options+ Hash for the +input+ object. Keys starting with ;TI"O:out_ or :output_ affect only +output+. All other keys ;TI""are assigned to both objects.;T@o; ; [I"7The :output_row_sep +option+ defaults to ;TI"4$INPUT_RECORD_SEPARATOR ($/).;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"—filter( options = Hash.new ) { |row| ... } filter( input, options = Hash.new ) { |row| ... } filter( input, output, options = Hash.new ) { |row| ... } ;TI"row;T[I" (*args);T@"FI"CSV;TcRDoc::NormalClass00generate-c.ri000064400000002111152402455720007113 0ustar00U:RDoc::AnyMethod[iI" generate:EFI"CSV::generate;TT: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"NThis method wraps a String you provide, or an empty default String, in a ;TI"QCSV object which is passed to the provided block. You can use the block to ;TI"Nappend CSV rows to the String and when the block exits, the final String ;TI"will be returned.;To:RDoc::Markup::BlankLineo; ; [I"PNote that a passed String *is* modified by this method. Call dup() before ;TI"&passing if you need a new String.;T@o; ; [ I"RThe +options+ parameter can be anything CSV::new() understands. This method ;TI"Nunderstands an additional :encoding parameter when not passed a ;TI"QString to set the base Encoding for the output. CSV needs this hint if you ;TI".plan to output non-ASCII compatible data.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"dgenerate( str, options = Hash.new ) { |csv| ... } generate( options = Hash.new ) { |csv| ... } ;TI"csv;T[I" (*args);T@FI"CSV;TcRDoc::NormalClass00parse_headers-i.ri000064400000001415152402455720010142 0ustar00U:RDoc::AnyMethod[iI"parse_headers:EFI"CSV#parse_headers;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"PThis method is used to turn a finished +row+ into a CSV::Row. Header rows ;TI"Mare also dealt with here, either by returning a CSV::Row with identical ;TI"Pheaders and fields (save that the fields do not go through the converters) ;TI"Nor by reading past them to return a field row. Headers are also saved in ;TI".@headers for use in future rows.;To:RDoc::Markup::BlankLineo; ; [I"PWhen +nil+, +row+ is assumed to be a header row not based on an actual row ;TI"of the stream.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(row = nil);T@FI"CSV;TcRDoc::NormalClass00quote_char-i.ri000064400000000532152402455720007466 0ustar00U:RDoc::Attr[iI"quote_char:ETI"CSV#quote_char;TI"R;T: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QThe encoded :quote_char used in parsing and writing. See CSV::new ;TI"for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0F@I"CSV;TcRDoc::NormalClass0convert_fields-i.ri000064400000001171152402455720010342 0ustar00U:RDoc::AnyMethod[iI"convert_fields:EFI"CSV#convert_fields;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"RProcesses +fields+ with @converters, or @header_converters ;TI"Oif +headers+ is passed as +true+, returning the converted field set. Any ;TI"Oconverter that changes the field into something other than a String halts ;TI"Qthe pipeline of conversion for that field. This is primarily an efficiency ;TI"shortcut.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(fields, headers = false);T@FI"CSV;TcRDoc::NormalClass00cdesc-CSV.ri000064400000025734152402455720006633 0ustar00U:RDoc::NormalClass[iI"CSV:ET@I" Object;To:RDoc::Markup::Document: @parts[o;;[;o:RDoc::Markup::Paragraph;[I"PThis class provides a complete interface to CSV files and data. It offers ;TI"Qtools to enable you to read and write to and from Strings or IO objects, as ;TI" needed.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Reading;T@S; ; i; I"From a File;T@S; ; i ; I"A Line at a Time;T@o:RDoc::Markup::Verbatim;[I".CSV.foreach("path/to/file.csv") do |row| ;TI" # use row here... ;TI" end ;T: @format0S; ; i ; I"All at Once;T@o;;[I"0arr_of_arrs = CSV.read("path/to/file.csv") ;T;0S; ; i; I"From a String;T@S; ; i ; I"A Line at a Time;T@o;;[I"+CSV.parse("CSV,data,String") do |row| ;TI" # use row here... ;TI" end ;T;0S; ; i ; I"All at Once;T@o;;[I"0arr_of_arrs = CSV.parse("CSV,data,String") ;T;0S; ; i; I" Writing;T@S; ; i; I"To a File;T@o;;[ I"1CSV.open("path/to/file.csv", "wb") do |csv| ;TI"+ csv << ["row", "of", "CSV", "data"] ;TI"! csv << ["another", "row"] ;TI" # ... ;TI" end ;T;0S; ; i; I"To a String;T@o;;[ I"(csv_string = CSV.generate do |csv| ;TI"+ csv << ["row", "of", "CSV", "data"] ;TI"! csv << ["another", "row"] ;TI" # ... ;TI" end ;T;0S; ; i; I"Convert a Single Line;T@o;;[I"4csv_string = ["CSV", "data"].to_csv # to CSV ;TI"6csv_array = "CSV,String".parse_csv # from CSV ;T;0S; ; i; I"Shortcut Interface;T@o;;[ I"MCSV { |csv_out| csv_out << %w{my data here} } # to $stdout ;TI"NCSV(csv = "") { |csv_str| csv_str << %w{my data here} } # to a String ;TI"MCSV($stderr) { |csv_err| csv_err << %w{my data here} } # to $stderr ;TI"NCSV($stdin) { |csv_in| csv_in.each { |row| p row } } # from $stdin ;T;0S; ; i; I"Advanced Usage;T@S; ; i; I"Wrap an IO Object;T@o;;[I" csv = CSV.new(io, options) ;TI"Q# ... read (with gets() or each()) from and write (with <<) to csv here ... ;T;0S; ; i; I">CSV and Character Encodings (M17n or Multilingualization);T@o; ;[ I"TThis new CSV parser is m17n savvy. The parser works in the Encoding of the IO ;TI"Tor String object being read from or written to. Your data is never transcoded ;TI"S(unless you ask Ruby to transcode it for you) and will literally be parsed in ;TI"Sthe Encoding it is in. Thus CSV will return Arrays or Rows of Strings in the ;TI"SEncoding of your data. This is accomplished by transcoding the parser itself ;TI"into your Encoding.;T@o; ;[ I"SSome transcoding must take place, of course, to accomplish this multiencoding ;TI"Fsupport. For example, :col_sep, :row_sep, and ;TI"Q:quote_char must be transcoded to match your data. Hopefully this ;TI"Qmakes the entire process feel transparent, since CSV's defaults should just ;TI"Qmagically work for you data. However, you can set these values manually in ;TI"2the target Encoding to avoid the translation.;T@o; ;[ I"LIt's also important to note that while all of CSV's core parser is now ;TI"JEncoding agnostic, some features are not. For example, the built-in ;TI"Oconverters will try to transcode data to UTF-8 before making conversions. ;TI"RAgain, you can provide custom converters that are aware of your Encodings to ;TI"Javoid this translation. It's just too hard for me to support native ;TI",conversions in all of Ruby's Encodings.;T@o; ;[ I"TAnyway, the practical side of this is simple: make sure IO and String objects ;TI"Spassed into CSV have the proper Encoding set and everything should just work. ;TI"QCSV methods that allow you to open IO objects (CSV::foreach(), CSV::open(), ;TI"MCSV::read(), and CSV::readlines()) do allow you to specify the Encoding.;T@o; ;[ I"ROne minor exception comes when generating CSV into a String with an Encoding ;TI"Othat is not ASCII compatible. There's no existing data for CSV to use to ;TI"Tprepare itself and thus you will probably need to manually specify the desired ;TI"SEncoding for most of those cases. It will try to guess using the fields in a ;TI"Mrow of output though, when using CSV::generate_line() or Array#to_csv().;T@o; ;[I"RI try to point out any other Encoding issues in the documentation of methods ;TI"as they come up.;T@o; ;[ I"SThis has been tested to the best of my ability with all non-"dummy" Encodings ;TI"MRuby ships with. However, it is brave new code and may have some bugs. ;TI"SPlease feel free to {report}[mailto:james@grayproductions.net] any issues you ;TI"find with it.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ I" col_sep;TI"R;T: publicFI"lib/csv.rb;T[ I" encoding;TI"R;T;F@Œ[ I"field_size_limit;TI"R;T;F@Œ[ I" lineno;TI"R;T;F@Œ[ I"quote_char;TI"R;T;F@Œ[ I" row_sep;TI"R;T;F@Œ[ I"skip_lines;TI"R;T;F@Œ[ U:RDoc::Constant[iI" VERSION;FI"CSV::VERSION;T00o;;[o; ;[I"*The version of the installed library.;T;@‡;0@‡@cRDoc::NormalClass0U;[iI"FieldInfo;FI"CSV::FieldInfo;T00o;;[o; ;[ I"NA FieldInfo Struct contains details about a field's position in the data ;TI"Rsource it was read from. CSV will pass this Struct to some blocks that make ;TI"Jdecisions based on field structure. See CSV.convert_fields() for an ;TI" example.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I"index;T;[o; ;[I"2The zero-based index of the field in its row.;To;;[I"line;T;[o; ;[I"2The line of the data source this row is from.;To;;[I"header;T;[o; ;[I"/The header for the column, when available.;T;@‡;0@‡@@©0U;[iI"DateMatcher;FI"CSV::DateMatcher;T00o;;[o; ;[I"@A Regexp used to find and convert some common Date formats.;T;@‡;0@‡@@©0U;[iI"DateTimeMatcher;FI"CSV::DateTimeMatcher;T00o;;[o; ;[I"DA Regexp used to find and convert some common DateTime formats.;T;@‡;0@‡@@©0U;[iI"ConverterEncoding;FI"CSV::ConverterEncoding;T00o;;[o; ;[I")The encoding used by all converters.;T;@‡;0@‡@@©0U;[iI"Converters;FI"CSV::Converters;T00o;;[ o; ;[I"RThis Hash holds the built-in converters of CSV that can be accessed by name. ;TI"PYou can select Converters with CSV.convert() or through the +options+ Hash ;TI"passed to CSV::new().;T@o;;;;[ o;;[I":integer;T;[o; ;[I"*Converts any field Integer() accepts.;To;;[I":float;T;[o; ;[I"(Converts any field Float() accepts.;To;;[I":numeric;T;[o; ;[I"(A combination of :integer ;TI"and :float.;To;;[I":date;T;[o; ;[I".Converts any field Date::parse() accepts.;To;;[I":date_time;T;[o; ;[I"2Converts any field DateTime::parse() accepts.;To;;[I":all;T;[o; ;[I"0All built-in converters. A combination of ;TI"/:date_time and :numeric.;T@o; ;[I"OAll built-in converters transcode field data to UTF-8 before attempting a ;TI"Qconversion. If your data cannot be transcoded to UTF-8 the conversion will ;TI".fail and the field will remain unchanged.;T@o; ;[I"PThis Hash is intentionally left unfrozen and users should feel free to add ;TI":values to it that can be accessed by all CSV objects.;T@o; ;[I"PTo add a combo field, the value should be an Array of names. Combo fields ;TI"+can be nested with other combo fields.;T;@‡;0@‡@@©0U;[iI"HeaderConverters;FI"CSV::HeaderConverters;T00o;;[ o; ;[I"PThis Hash holds the built-in header converters of CSV that can be accessed ;TI"Lby name. You can select HeaderConverters with CSV.header_convert() or ;TI"5through the +options+ Hash passed to CSV::new().;T@o;;;;[o;;[I":downcase;T;[o; ;[I"+Calls downcase() on the header String.;To;;[I":symbol;T;[o; ;[I"0The header String is downcased, spaces are ;TI"4replaced with underscores, non-word characters ;TI"1are dropped, and finally to_sym() is called.;T@o; ;[I"JAll built-in header converters transcode header data to UTF-8 before ;TI"Nattempting a conversion. If your data cannot be transcoded to UTF-8 the ;TI"?conversion will fail and the header will remain unchanged.;T@o; ;[I"PThis Hash is intentionally left unfrozen and users should feel free to add ;TI":values to it that can be accessed by all CSV objects.;T@o; ;[I"PTo add a combo field, the value should be an Array of names. Combo fields ;TI"+can be nested with other combo fields.;T;@‡;0@‡@@©0U;[iI"DEFAULT_OPTIONS;FI"CSV::DEFAULT_OPTIONS;T00o;;[o; ;[I"MThe options used when no overrides are given by calling code. They are:;T@o;;;;[o;;[I":col_sep;T;[o; ;[I"",";To;;[I":row_sep;T;[o; ;[I":auto;To;;[I" :quote_char;T;[o; ;[I"'"';To;;[I"&:field_size_limit;T;[o; ;[I" +nil+;To;;[I" :converters;T;[o; ;[I" +nil+;To;;[I"(:unconverted_fields;T;[o; ;[I" +nil+;To;;[I":headers;T;[o; ;[I" +false+;To;;[I"$:return_headers;T;[o; ;[I" +false+;To;;[I"':header_converters;T;[o; ;[I" +nil+;To;;[I"!:skip_blanks;T;[o; ;[I" +false+;To;;[I"":force_quotes;T;[o; ;[I" +false+;To;;[I" :skip_lines;T;[o; ;[I" +nil+;T;@‡;0@‡@@©0[[I"Enumerable;To;;[;@‡;0@Œ[[I" class;T[[;[[I" filter;F@Œ[I" foreach;F@Œ[I" generate;F@Œ[I"generate_line;F@Œ[I" instance;F@Œ[I"new;T@Œ[I" open;F@Œ[I" parse;F@Œ[I"parse_line;F@Œ[I" read;F@Œ[I"readlines;F@Œ[I" table;F@Œ[:protected[[: private[[I" instance;T[[;[[I"<<;T@Œ[I" add_row;T@Œ[I" convert;F@Œ[I"converters;F@Œ[I" each;F@Œ[I"force_quotes?;F@Œ[I" gets;T@Œ[I"header_convert;F@Œ[I"header_converters;F@Œ[I"header_row?;F@Œ[I" headers;F@Œ[I" inspect;F@Œ[I" puts;T@Œ[I" read;F@Œ[I" readline;T@Œ[I"readlines;T@Œ[I"return_headers?;F@Œ[I" rewind;F@Œ[I" shift;F@Œ[I"skip_blanks?;F@Œ[I"unconverted_fields?;F@Œ[I"write_headers?;F@Œ[;[[;[[I"add_converter;F@Œ[I"add_unconverted_fields;F@Œ[I"convert_fields;F@Œ[I"encode_re;F@Œ[I"encode_str;F@Œ[I"escape_re;F@Œ[I"init_comments;F@Œ[I"init_converters;F@Œ[I"init_headers;F@Œ[I"init_parsers;F@Œ[I"init_separators;F@Œ[I"parse_headers;F@Œ[I"raw_encoding;F@Œ[[I"Forwardable;To;;[o; ;[I"#IO and StringIO Delegation ###;T;@‡;0@Œ[U:RDoc::Context::Section[i0o;;[;0;0[@‡@‡cRDoc::TopLevelRow/values_at-i.ri000064400000000431152402455720010064 0ustar00U:RDoc::AnyMethod[iI"values_at:ETI"CSV::Row#values_at;TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(*headers_and_or_indices);T@ FI"Row;TcRDoc::NormalClass0[I" CSV::Row;TFI" fields;FRow/has_key%3f-i.ri000064400000000644152402455720010030 0ustar00U:RDoc::AnyMethod[iI" has_key?:EFI"CSV::Row#has_key?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@Returns +true+ if there is a field with the given +header+.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I" include?;To;; [; @; 0[I" key?;To;; [; @; 0[I" member?;To;; [; @; 0I" (header);T@FI"Row;TcRDoc::NormalClass00Row/field-i.ri000064400000001342152402455720007166 0ustar00U:RDoc::AnyMethod[iI" field:EFI"CSV::Row#field;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QThis method will return the field value by +header+ or +index+. If a field ;TI"%is not found, +nil+ is returned.;To:RDoc::Markup::BlankLineo; ; [I"LWhen provided, +offset+ ensures that a header match occurs on or later ;TI"Kthan the +offset+ index. You can use this to find duplicate headers, ;TI"4without resorting to hard-coding exact indices.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"A shortcut for appending multiple fields. Equivalent to:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"(args.each { |arg| csv_row << arg } ;T: @format0o; ; [I".This method returns the row for chaining.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI"Row;TcRDoc::NormalClass00Row/%5b%5d-i.ri000064400000000425152402455720006755 0ustar00U:RDoc::AnyMethod[iI"[]:ETI"CSV::Row#[];TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I")(header_or_index, minimum_index = 0);T@ FI"Row;TcRDoc::NormalClass0[I" CSV::Row;TFI" field;FRow/fields-i.ri000064400000001227152402455720007353 0ustar00U:RDoc::AnyMethod[iI" fields:EFI"CSV::Row#fields;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"PThis method accepts any number of arguments which can be headers, indices, ;TI"MRanges of either, or two-element Arrays containing a header and offset. ;TI"HEach argument will be replaced with a field lookup as described in ;TI"CSV::Row.field().;To:RDoc::Markup::BlankLineo; ; [I":If called with no arguments, all fields are returned.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I"values_at;To;; [; @; 0I"(*headers_and_or_indices);T@FI"Row;TcRDoc::NormalClass00Row/to_s-i.ri000064400000000412152402455720007044 0ustar00U:RDoc::AnyMethod[iI" to_s:ETI"CSV::Row#to_s;TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(options = Hash.new);T@ FI"Row;TcRDoc::NormalClass0[I" CSV::Row;TFI" to_csv;FRow/delete-i.ri000064400000001053152402455720007344 0ustar00U:RDoc::AnyMethod[iI" delete:EFI"CSV::Row#delete;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MUsed to remove a pair from the row by +header+ or +index+. The pair is ;TI"Nlocated as described in CSV::Row.field(). The deleted pair is returned, ;TI"+or +nil+ if a pair could not be found.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"?delete( header ) delete( header, offset ) delete( index ) ;T0[I")(header_or_index, minimum_index = 0);T@FI"Row;TcRDoc::NormalClass00Row/index-i.ri000064400000000774152402455720007222 0ustar00U:RDoc::AnyMethod[iI" index:EFI"CSV::Row#index;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NThis method will return the index of a field with the provided +header+. ;TI"PThe +offset+ can be used to locate duplicate header names, as described in ;TI"CSV::Row.field().;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"-index( header ) index( header, offset ) ;T0[I" (header, minimum_index = 0);T@FI"Row;TcRDoc::NormalClass00Row/delete_if-i.ri000064400000001026152402455720010022 0ustar00U:RDoc::AnyMethod[iI"delete_if:EFI"CSV::Row#delete_if;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PThe provided +block+ is passed a header and field for each pair in the row ;TI"Mand expected to return +true+ or +false+, depending on whether the pair ;TI"should be deleted.;To:RDoc::Markup::BlankLineo; ; [I".This method returns the row for chaining.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (&block);T@FI"Row;TcRDoc::NormalClass00Row/field%3f-i.ri000064400000000533152402455720007465 0ustar00U:RDoc::AnyMethod[iI" field?:EFI"CSV::Row#field?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GReturns +true+ if +data+ matches a field in this row, and +false+ ;TI"otherwise.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (data);T@FI"Row;TcRDoc::NormalClass00Row/to_hash-i.ri000064400000000574152402455720007536 0ustar00U:RDoc::AnyMethod[iI" to_hash:EFI"CSV::Row#to_hash;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PCollapses the row into a simple Hash. Be warning that this discards field ;TI")order and clobbers duplicate fields.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"Row;TcRDoc::NormalClass00Row/to_csv-i.ri000064400000000743152402455720007404 0ustar00U:RDoc::AnyMethod[iI" to_csv:EFI"CSV::Row#to_csv;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns the row as a CSV String. Headers are not used. Equivalent to:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"%csv_row.fields.to_csv( options );T: @format0: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I" to_s;To;; [;@;0I"(options = Hash.new);T@FI"Row;TcRDoc::NormalClass00Row/header%3f-i.ri000064400000000563152402455720007635 0ustar00U:RDoc::AnyMethod[iI" header?:EFI"CSV::Row#header?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns +true+ if +name+ is a header for this row, and +false+ otherwise.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I" include?;To;; [; @; 0I" (name);T@FI"Row;TcRDoc::NormalClass00Row/%5b%5d%3d-i.ri000064400000001177152402455720007256 0ustar00U:RDoc::AnyMethod[iI"[]=:EFI"CSV::Row#[]=;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KLooks up the field by the semantics described in CSV::Row.field() and ;TI"assigns the +value+.;To:RDoc::Markup::BlankLineo; ; [I"PAssigning past the end of the row with an index will set all pairs between ;TI"Lto [nil, nil]. Assigning to an unused header appends the new ;TI" pair.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"K[]=( header, value ) []=( header, offset, value ) []=( index, value ) ;T0[I" (*args);T@FI"Row;TcRDoc::NormalClass00Row/headers-i.ri000064400000000446152402455720007522 0ustar00U:RDoc::AnyMethod[iI" headers:EFI"CSV::Row#headers;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"%Returns the headers of this row.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"Row;TcRDoc::NormalClass00Row/member%3f-i.ri000064400000000406152402455720007650 0ustar00U:RDoc::AnyMethod[iI" member?:ETI"CSV::Row#member?;TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (header);T@ FI"Row;TcRDoc::NormalClass0[I" CSV::Row;TFI" has_key?;FRow/each-i.ri000064400000000741152402455720007005 0ustar00U:RDoc::AnyMethod[iI" each:EFI"CSV::Row#each;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"GYields each pair of the row as header and field tuples (much like ;TI"iterating over a Hash).;To:RDoc::Markup::BlankLineo; ; [I"Support for Enumerable.;T@o; ; [I".This method returns the row for chaining.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (&block);T@FI"Row;TcRDoc::NormalClass00Row/field_row%3f-i.ri000064400000000462152402455720010355 0ustar00U:RDoc::AnyMethod[iI"field_row?:EFI"CSV::Row#field_row?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"+Returns +true+ if this is a field row.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"Row;TcRDoc::NormalClass00Row/%3c%3c-i.ri000064400000001302152402455720006744 0ustar00U:RDoc::AnyMethod[iI"<<:ETI"CSV::Row#<<;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"PIf a two-element Array is provided, it is assumed to be a header and field ;TI"Mand the pair is appended. A Hash works the same way with the key being ;TI"Othe header and the value being the field. Anything else is assumed to be ;TI"8a lone field which is appended with a +nil+ header.;To:RDoc::Markup::BlankLineo; ; [I".This method returns the row for chaining.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"J<<( field ) <<( header_and_field_array ) <<( header_and_field_hash ) ;T0[I" (arg);T@FI"Row;TcRDoc::NormalClass00Row/%3d%3d-i.ri000064400000000545152402455720006756 0ustar00U:RDoc::AnyMethod[iI"==:ETI"CSV::Row#==;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns +true+ if this row contains the same headers and fields in the ;TI"same order as +other+.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (other);T@FI"Row;TcRDoc::NormalClass00add_row-i.ri000064400000000353152402455720006754 0ustar00U:RDoc::AnyMethod[iI" add_row:ETI"CSV#add_row;TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (row);T@ FI"CSV;TcRDoc::NormalClass0[@FI"<<;Trow_sep-i.ri000064400000000521152402455720007010 0ustar00U:RDoc::Attr[iI" row_sep:ETI"CSV#row_sep;TI"R;T: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NThe encoded :row_sep used in parsing and writing. See CSV::new ;TI"for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0F@I"CSV;TcRDoc::NormalClass0init_separators-i.ri000064400000001362152402455720010544 0ustar00U:RDoc::AnyMethod[iI"init_separators:EFI"CSV#init_separators;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"3Stores the indicated separators for later use.;To:RDoc::Markup::BlankLineo; ; [ I"RIf auto-discovery was requested for @row_sep, this method will read ;TI"Pahead in the @io and try to find one. +ARGF+, +STDIN+, +STDOUT+, ;TI"A+STDERR+ and any stream open for output only with a default ;TI"I@row_sep of $INPUT_RECORD_SEPARATOR ($/).;T@o; ; [I"HThis method also establishes the quoting rules used for CSV output.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(options);T@FI"CSV;TcRDoc::NormalClass00parse_line-c.ri000064400000001103152402455720007442 0ustar00U:RDoc::AnyMethod[iI"parse_line:EFI"CSV::parse_line;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QThis method is a shortcut for converting a single line of a CSV String into ;TI"Pan Array. Note that if +line+ contains multiple rows, anything beyond the ;TI"first row is ignored.;To:RDoc::Markup::BlankLineo; ; [I"DThe +options+ parameter can be anything CSV::new() understands.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(line, options = Hash.new);T@FI"CSV;TcRDoc::NormalClass00readlines-c.ri000064400000000441152402455720007273 0ustar00U:RDoc::AnyMethod[iI"readlines:EFI"CSV::readlines;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Alias for CSV::read().;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI"CSV;TcRDoc::NormalClass00open-c.ri000064400000005723152402455720006276 0ustar00U:RDoc::AnyMethod[iI" open:EFI"CSV::open;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PThis method opens an IO object, and wraps that with CSV. This is intended ;TI"5as the primary interface for writing a CSV file.;To:RDoc::Markup::BlankLineo; ; [I"KYou must pass a +filename+ and may optionally add a +mode+ for Ruby's ;TI"Jopen(). You may also pass an optional Hash containing any +options+ ;TI"2CSV::new() understands as the final argument.;T@o; ; [ I"RThis method works like Ruby's open() call, in that it will pass a CSV object ;TI"Lto a provided block and close it when the block terminates, or it will ;TI"Rreturn the CSV object when no block is provided. (*Note*: This is different ;TI"Hfrom the Ruby 1.8 CSV library which passed rows to the block. Use ;TI"'CSV::foreach() for that behavior.);T@o; ; [ I"PYou must provide a +mode+ with an embedded Encoding designator unless your ;TI"Rdata is in Encoding::default_external(). CSV will check the Encoding of the ;TI"Qunderlying IO object (set by the +mode+ you pass) to determine how to parse ;TI"Rthe data. You may provide a second Encoding to have the data transcoded as ;TI"Pit is read just as you can with a normal call to IO::open(). For example, ;TI"M"rb:UTF-32BE:UTF-8" would read UTF-32BE data from the file but ;TI"0transcode it to UTF-8 before CSV parses it.;T@o; ; [I"QAn opened CSV object will delegate to many IO methods for convenience. You ;TI"may call:;T@o:RDoc::Markup::List: @type: BULLET: @items[$o:RDoc::Markup::ListItem: @label0; [o; ; [I"binmode();To;;0; [o; ; [I"binmode?();To;;0; [o; ; [I" close();To;;0; [o; ; [I"close_read();To;;0; [o; ; [I"close_write();To;;0; [o; ; [I"closed?();To;;0; [o; ; [I" eof();To;;0; [o; ; [I" eof?();To;;0; [o; ; [I"external_encoding();To;;0; [o; ; [I" fcntl();To;;0; [o; ; [I" fileno();To;;0; [o; ; [I" flock();To;;0; [o; ; [I" flush();To;;0; [o; ; [I" fsync();To;;0; [o; ; [I"internal_encoding();To;;0; [o; ; [I" ioctl();To;;0; [o; ; [I" isatty();To;;0; [o; ; [I" path();To;;0; [o; ; [I" pid();To;;0; [o; ; [I" pos();To;;0; [o; ; [I" pos=();To;;0; [o; ; [I" reopen();To;;0; [o; ; [I" seek();To;;0; [o; ; [I" stat();To;;0; [o; ; [I" sync();To;;0; [o; ; [I" sync=();To;;0; [o; ; [I" tell();To;;0; [o; ; [I" to_i();To;;0; [o; ; [I" to_io();To;;0; [o; ; [I"truncate();To;;0; [o; ; [I" tty?();T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"Øopen( filename, mode = "rb", options = Hash.new ) { |faster_csv| ... } open( filename, options = Hash.new ) { |faster_csv| ... } open( filename, mode = "rb", options = Hash.new ) open( filename, options = Hash.new ) ;TI"csv;T[I" (*args);T@ÁFI"CSV;TcRDoc::NormalClass00read-i.ri000064400000000650152402455720006250 0ustar00U:RDoc::AnyMethod[iI" read:EFI" CSV#read;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Slurps the remaining rows and returns an Array of Arrays.;To:RDoc::Markup::BlankLineo; ; [I".The data source must be open for reading.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I"readlines;To;; [; @; 0I"();T@FI"CSV;TcRDoc::NormalClass00init_parsers-i.ri000064400000000530152402455720010034 0ustar00U:RDoc::AnyMethod[iI"init_parsers:EFI"CSV#init_parsers;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"JPre-compiles parsers and stores them by name for access during reads.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(options);T@FI"CSV;TcRDoc::NormalClass00MalformedCSVError/cdesc-MalformedCSVError.ri000064400000000772152402455720014763 0ustar00U:RDoc::NormalClass[iI"MalformedCSVError:ETI"CSV::MalformedCSVError;TI"RuntimeError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"HThe error thrown when the parser encounters illegal CSV formatting.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[@I"CSV;TcRDoc::NormalClassgets-i.ri000064400000000345152402455720006300 0ustar00U:RDoc::AnyMethod[iI" gets:ETI" CSV#gets;TF: publico:RDoc::Markup::Document: @parts[: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CSV;TcRDoc::NormalClass0[@FI" shift;Fconverters-i.ri000064400000000664152402455720007534 0ustar00U:RDoc::AnyMethod[iI"converters:EFI"CSV#converters;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RReturns the current list of converters in effect. See CSV::new for details. ;TI"QBuilt-in converters will be returned by name, while others will be returned ;TI" as is.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00foreach-c.ri000064400000002205152402455720006734 0ustar00U:RDoc::AnyMethod[iI" foreach:EFI"CSV::foreach;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RThis method is intended as the primary interface for reading CSV files. You ;TI"Ppass a +path+ and any +options+ you wish to set for the read. Each row of ;TI"9file will be passed to the provided +block+ in turn.;To:RDoc::Markup::BlankLineo; ; [ I"RThe +options+ parameter can be anything CSV::new() understands. This method ;TI"Ralso understands an additional :encoding parameter that you can use ;TI"Rto specify the Encoding of the data in the file to be read. You must provide ;TI"Rthis unless your data is in Encoding::default_external(). CSV will use this ;TI"Oto determine how to parse the data. You may provide a second Encoding to ;TI";have the data transcoded as it is read. For example, ;TI"Pencoding: "UTF-32BE:UTF-8" would read UTF-32BE data from the file ;TI"4but transcode it to UTF-8 before CSV parses it.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"'(path, options = Hash.new, &block);T@FI"CSV;TcRDoc::NormalClass00headers-i.ri000064400000000665152402455720006756 0ustar00U:RDoc::AnyMethod[iI" headers:EFI"CSV#headers;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QReturns +nil+ if headers will not be used, +true+ if they will but have not ;TI"Jyet been read, or the actual headers after they have been read. See ;TI"CSV::new for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00init_converters-i.ri000064400000001305152402455720010550 0ustar00U:RDoc::AnyMethod[iI"init_converters:EFI"CSV#init_converters;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"8Loads any converters requested during construction.;To:RDoc::Markup::BlankLineo; ; [I"PIf +field_name+ is set :converters (the default) field converters ;TI"Rare set. When +field_name+ is :header_converters header converters ;TI"are added instead.;T@o; ; [I"AThe :unconverted_fields option is also actived for ;TI".:converters calls, if requested.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"((options, field_name = :converters);T@FI"CSV;TcRDoc::NormalClass00rewind-i.ri000064400000000502152402455720006621 0ustar00U:RDoc::AnyMethod[iI" rewind:EFI"CSV#rewind;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HRewinds the underlying IO object and resets CSV's lineno() counter.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00table-c.ri000064400000001026152402455720006414 0ustar00U:RDoc::AnyMethod[iI" table:EFI"CSV::table;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"A shortcut for:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"0CSV.read( path, { headers: true, ;TI"4 converters: :numeric, ;TI"D header_converters: :symbol }.merge(options) );T: @format0: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(path, options = Hash.new);T@FI"CSV;TcRDoc::NormalClass00Table/values_at-i.ri000064400000001322152402455720010344 0ustar00U:RDoc::AnyMethod[iI"values_at:EFI"CSV::Table#values_at;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"IThe mixed mode default is to treat a list of indices as row access, ;TI"Ireturning the rows indicated. Anything else is considered columnar ;TI"Laccess. For columnar access, the return set has an Array for each row ;TI"Lwith the values indicated by the headers in each Array. You can force ;TI"5column or row mode using by_col!() or by_row!().;To:RDoc::Markup::BlankLineo; ; [I"*You cannot mix column and row access.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(*indices_or_headers);T@FI" Table;TcRDoc::NormalClass00Table/by_row%21-i.ri000064400000000774152402455720010104 0ustar00U:RDoc::AnyMethod[iI" by_row!:EFI"CSV::Table#by_row!;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MSwitches the mode of this table to row mode. All calls to indexing and ;TI"Kiteration methods will work with rows until the mode is changed again.;To:RDoc::Markup::BlankLineo; ; [I"8This method returns the table and is safe to chain.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Table;TcRDoc::NormalClass00Table/inspect-i.ri000064400000000505152402455720010030 0ustar00U:RDoc::AnyMethod[iI" inspect:EFI"CSV::Table#inspect;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@Shows the mode and size of this table in a US-ASCII String.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Table;TcRDoc::NormalClass00Table/to_a-i.ri000064400000000573152402455720007312 0ustar00U:RDoc::AnyMethod[iI" to_a:EFI"CSV::Table#to_a;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns the table as an Array of Arrays. Headers will be the first row, ;TI",then all of the field rows will follow.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Table;TcRDoc::NormalClass00Table/new-c.ri000064400000001320152402455720007142 0ustar00U:RDoc::AnyMethod[iI"new:ETI"CSV::Table::new;TT: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"IConstruct a new CSV::Table from +array_of_rows+, which are expected ;TI"Lto be CSV::Row objects. All rows are assumed to have the same headers.;To:RDoc::Markup::BlankLineo; ; [I"FA CSV::Table object supports the following Array methods through ;TI"delegation:;T@o:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I" empty?();To;;0; [o; ; [I" length();To;;0; [o; ; [I" size();T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(array_of_rows);T@%FI" Table;TcRDoc::NormalClass00Table/push-i.ri000064400000000744152402455720007347 0ustar00U:RDoc::AnyMethod[iI" push:EFI"CSV::Table#push;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I":write_headers => false.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I" to_s;To;; [; @; 0I"(options = Hash.new);T@FI" Table;TcRDoc::NormalClass00Table/%5b%5d%3d-i.ri000064400000002110152402455720007522 0ustar00U:RDoc::AnyMethod[iI"[]=:EFI"CSV::Table#[]=;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NIn the default mixed mode, this method assigns rows for index access and ;TI"Ncolumns for header access. You can force the index association by first ;TI"$calling by_col!() or by_row!().;To:RDoc::Markup::BlankLineo; ; [I"KRows may be set to an Array of values (which will inherit the table's ;TI"headers()) or a CSV::Row.;T@o; ; [ I"NColumns may be set to a single value, which is copied to each row of the ;TI"Ocolumn, or an Array of values. Arrays of values are assigned to rows top ;TI"Oto bottom in row major order. Excess values are ignored and if the Array ;TI"Ldoes not have a value for each row the extra rows will receive a +nil+.;T@o; ; [I"MAssigning to an existing column or row clobbers the data. Assigning to ;TI":col_sep used in parsing and writing. See CSV::new ;TI"for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0F@I"CSV;TcRDoc::NormalClass0%3c%3c-i.ri000064400000001155152402455720006203 0ustar00U:RDoc::AnyMethod[iI"<<:ETI" CSV#<<;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NThe primary write method for wrapped Strings and IOs, +row+ (an Array or ;TI"LCSV::Row) is converted to CSV and appended to the data source. When a ;TI"LCSV::Row is passed, only the row's fields() are appended to the output.;To:RDoc::Markup::BlankLineo; ; [I".The data source must be open for writing.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[[I" add_row;To;; [; @; 0[I" puts;To;; [; @; 0I" (row);T@FI"CSV;TcRDoc::NormalClass00add_unconverted_fields-i.ri000064400000000770152402455720012032 0ustar00U:RDoc::AnyMethod[iI"add_unconverted_fields:EFI"CSV#add_unconverted_fields;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OThis method injects an instance variable unconverted_fields into ;TI"N+row+ and an accessor method for +row+ called unconverted_fields(). The ;TI"1variable is set to the contents of +fields+.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(row, fields);T@FI"CSV;TcRDoc::NormalClass00raw_encoding-i.ri000064400000000626152402455720007777 0ustar00U:RDoc::AnyMethod[iI"raw_encoding:EFI"CSV#raw_encoding;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns the encoding of the internal IO object or the +default+ if the ;TI"#encoding cannot be determined.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"%(default = Encoding::ASCII_8BIT);T@FI"CSV;TcRDoc::NormalClass00convert-i.ri000064400000001566152402455720007024 0ustar00U:RDoc::AnyMethod[iI" convert:EFI"CSV#convert;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QYou can use this method to install a CSV::Converters built-in, or provide a ;TI",block that handles a custom conversion.;To:RDoc::Markup::BlankLineo; ; [ I"QIf you provide a block that takes one argument, it will be passed the field ;TI"Qand is expected to return the converted value or the field itself. If your ;TI"Pblock takes two arguments, it will also be passed a CSV::FieldInfo Struct, ;TI"Kcontaining details about the field. Again, the block should return a ;TI")converted field or the field itself.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"Qconvert( name ) convert { |field| ... } convert { |field, field_info| ... } ;T0[I"(name = nil, &converter);T@FI"CSV;TcRDoc::NormalClass00force_quotes%3f-i.ri000064400000000526152402455720010333 0ustar00U:RDoc::AnyMethod[iI"force_quotes?:EFI"CSV#force_quotes?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns +true+ if all output fields are quoted. See CSV::new for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00generate_line-c.ri000064400000001625152402455720010133 0ustar00U:RDoc::AnyMethod[iI"generate_line:EFI"CSV::generate_line;TT: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NThis method is a shortcut for converting a single row (Array) into a CSV ;TI" String.;To:RDoc::Markup::BlankLineo; ; [ I"RThe +options+ parameter can be anything CSV::new() understands. This method ;TI"Lunderstands an additional :encoding parameter to set the base ;TI"PEncoding for the output. This method will try to guess your Encoding from ;TI"Nthe first non-+nil+ field in +row+, if possible, but you may need to use ;TI"%this parameter as a backup plan.;T@o; ; [I"QThe :row_sep +option+ defaults to $INPUT_RECORD_SEPARATOR ;TI",($/) when calling this method.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(row, options = Hash.new);T@FI"CSV;TcRDoc::NormalClass00unconverted_fields%3f-i.ri000064400000000564152402455720011521 0ustar00U:RDoc::AnyMethod[iI"unconverted_fields?:EFI"CSV#unconverted_fields?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MReturns +true+ if unconverted_fields() to parsed results. See CSV::new ;TI"for details.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CSV;TcRDoc::NormalClass00init_headers-i.ri000064400000000525152402455720007774 0ustar00U:RDoc::AnyMethod[iI"init_headers:EFI"CSV#init_headers;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GStores header row settings and loads header converters, if needed.;T: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below000[I"(options);T@FI"CSV;TcRDoc::NormalClass00