aboutsummaryrefslogtreecommitdiffstats
path: root/lib/csv/core_ext/array.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csv/core_ext/array.rb')
-rw-r--r--lib/csv/core_ext/array.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/csv/core_ext/array.rb b/lib/csv/core_ext/array.rb
new file mode 100644
index 0000000000..94df7d5c35
--- /dev/null
+++ b/lib/csv/core_ext/array.rb
@@ -0,0 +1,9 @@
+class Array # :nodoc:
+ # Equivalent to CSV::generate_line(self, options)
+ #
+ # ["CSV", "data"].to_csv
+ # #=> "CSV,data\n"
+ def to_csv(**options)
+ CSV.generate_line(self, options)
+ end
+end