generate(str=nil, **options) public

This method wraps a String you provide, or an empty default String, in a CSV object which is passed to the provided block. You can use the block to append CSV rows to the String and when the block exits, the final String will be returned.

Note that a passed String is modified by this method. Call dup() before passing if you need a new String.

The options parameter can be anything CSV::new() understands. This method understands an additional :encoding parameter when not passed a String to set the base Encoding for the output. CSV needs this hint if you plan to output non-ASCII compatible data.

Show source
Register or log in to add new notes.