D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby18
/
share
/
ri
/
1.8
/
system
/
CSV
/
Filename :
generate_row-c.yaml
back
Copy
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Convert a line from cells data to string. Consider using CSV.generate_line instead. To generate multi-row CSV string, see EXAMPLE below. - !ruby/struct:SM::Flow::P body: EXAMPLE - !ruby/struct:SM::Flow::VERB body: " row1 = ['a', 'b']\n row2 = ['c', 'd']\n row3 = ['e', 'f']\n src = [row1, row2, row3]\n buf = ''\n src.each do |row|\n parsed_cells = CSV.generate_row(row, 2, buf)\n puts "Created #{ parsed_cells } cells."\n end\n p buf\n" - !ruby/struct:SM::Flow::P body: ARGS - !ruby/struct:SM::Flow::VERB body: " src: an Array of String to be converted to CSV string. Must respond to\n 'size' and '[](idx)'. src[idx] must return String.\n cells: num of cells in a line.\n out_dev: buffer for generated CSV string. Must respond to '<<(string)'.\n col_sep: Column separator. ?, by default. If you want to separate\n fields with semicolon, give ?; here.\n row_sep: Row separator. nil by default. nil means "\\r\\n or \\n". If you\n want to separate records with \\r, give ?\\r here.\n" - !ruby/struct:SM::Flow::P body: RETURNS - !ruby/struct:SM::Flow::VERB body: " parsed_cells: num of converted cells.\n" full_name: CSV::generate_row is_singleton: true name: generate_row params: (src, cells, out_dev, fs = nil, rs = nil) visibility: public