generate

generate( str, options = Hash.new ) { |csv| ... }
generate( options = Hash.new ) { |csv| ... }
Class Public methods

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 modfied by this method. Call dup() before passing if you need a new String.

The options parameter can be anything ::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.

doc_ruby_on_rails
2015-04-01 21:41:14
Comments
Leave a Comment

Please login to continue.