send_csv 0.5 → 0.6
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/README.txt +1 -0
- data/lib/send_csv.rb +4 -7
- metadata +4 -3
data/README.txt
CHANGED
data/lib/send_csv.rb
CHANGED
@@ -1,24 +1,21 @@
|
|
1
|
-
require 'iconv'
|
2
|
-
|
3
1
|
module SendCsv
|
4
|
-
VERSION = '0.
|
2
|
+
VERSION = '0.6'
|
5
3
|
|
6
4
|
module_function
|
7
5
|
def generate_csv(lines, options = {})
|
8
6
|
require 'csv'
|
9
7
|
|
10
8
|
options = options.dup
|
11
|
-
encoding = options.delete(:encoding) || 'ISO-8859-
|
9
|
+
encoding = options.delete(:encoding) || 'ISO-8859-15'
|
12
10
|
|
13
|
-
csv = lines.map { |values| CSV.generate_line(values, ';'
|
14
|
-
csv =
|
11
|
+
csv = lines.map { |values| CSV.generate_line(values, :col_sep => ';', :row_sep => "\r\n") }.join
|
12
|
+
csv = csv.encode(encoding, :invalid => :replace, :undef => :replace)
|
15
13
|
|
16
14
|
csv
|
17
15
|
end
|
18
16
|
|
19
17
|
def send_csv(lines, options = {})
|
20
18
|
options = options.dup
|
21
|
-
encoding = options.delete(:encoding) || 'ISO-8859-1//TRANSLIT'
|
22
19
|
|
23
20
|
options = {
|
24
21
|
:disposition => "attachment",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: send_csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-06-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hoe
|
16
|
-
requirement: &
|
16
|
+
requirement: &80452450 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 2.9.4
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *80452450
|
25
25
|
description: Adds to ApplicationController a send_csv method working like send_file.
|
26
26
|
email:
|
27
27
|
- contact@ouvrages-web.fr
|
@@ -67,3 +67,4 @@ specification_version: 3
|
|
67
67
|
summary: Adds to ApplicationController a send_csv method working like send_file.
|
68
68
|
test_files:
|
69
69
|
- test/test_send_csv.rb
|
70
|
+
has_rdoc:
|