to_csv-rails 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +5 -2
- data/VERSION +1 -1
- data/init.rb +1 -0
- data/lib/to_csv-rails.rb +9 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/init.rb
CHANGED
data/lib/to_csv-rails.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
1
2
|
class Array
|
2
3
|
|
3
4
|
def to_csv(options = {})
|
@@ -22,7 +23,14 @@ class Array
|
|
22
23
|
end
|
23
24
|
|
24
25
|
self.each do |obj|
|
25
|
-
data << columns.map
|
26
|
+
data << columns.map do |column|
|
27
|
+
begin
|
28
|
+
column_value = obj.send(column).to_s
|
29
|
+
column_value.include?(",") ? "\"#{column_value}\"" : column_value
|
30
|
+
rescue
|
31
|
+
''
|
32
|
+
end
|
33
|
+
end.join(',')
|
26
34
|
end
|
27
35
|
data.join("\n")
|
28
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_csv-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This simple plugin gives you the ability to call to_csv to a collection
|
15
15
|
of activerecords. The builder options are the same as to_json / to_xml, except for
|