tabularasa 0.1.2 → 0.1.3
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/Manifest +2 -1
- data/README.rdoc +10 -13
- data/Rakefile +2 -1
- data/lib/to_csv.rb +2 -5
- data/tabularasa.gemspec +5 -2
- metadata +15 -4
data/Manifest
CHANGED
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
=
|
1
|
+
= tabularasa gem
|
2
2
|
|
3
|
-
This simple
|
3
|
+
This simple gem gives you the ability to call to_csv to a collection of activerecords. The builder options are the same as to_json / to_xml, except for the :include.
|
4
4
|
|
5
5
|
|
6
6
|
== Usage
|
@@ -38,25 +38,22 @@ In the controller where you want to export to csv, add the format.csv line (as o
|
|
38
38
|
|
39
39
|
== Dependencies
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
Else, install fastercsv:
|
44
|
-
sudo gem install fastercsv
|
41
|
+
ruby >= 1.9
|
45
42
|
|
46
43
|
|
47
44
|
== Install
|
48
45
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
== Ideas
|
53
|
-
|
54
|
-
I got ideas and influence from Mike Clarks recipe #35 in Rails Recipes book, some anonymous pastie, and whoever wrote to_xml/to_json builders.
|
46
|
+
gem install tabularasa
|
55
47
|
|
56
48
|
|
57
49
|
== Note
|
58
50
|
|
59
51
|
Does not work on a single activerecord, ie, User.first.to_csv.
|
60
52
|
|
53
|
+
== Contributors
|
54
|
+
|
55
|
+
* Ary Djmal (initial plugin)
|
56
|
+
* Chris Roasario (gem conversion)
|
57
|
+
|
61
58
|
|
62
|
-
Copyright (c)
|
59
|
+
Copyright (c) 2011 Chris Rosario, released under the MIT license
|
data/Rakefile
CHANGED
@@ -12,12 +12,13 @@ Rake::TestTask.new(:test) do |t|
|
|
12
12
|
t.verbose = true
|
13
13
|
end
|
14
14
|
|
15
|
-
Echoe.new('tabularasa', '0.1.
|
15
|
+
Echoe.new('tabularasa', '0.1.3') do |p|
|
16
16
|
p.description = "This Rails gem gives you the ability to call to_csv to a collection of activerecords"
|
17
17
|
p.url = "https://github.com/arydjmal/to_csv"
|
18
18
|
p.author = "Ary Djmal"
|
19
19
|
p.email = "arydjmal@gmail.com"
|
20
20
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
21
|
+
p.runtime_dependencies = ['ruby >=1.9']
|
21
22
|
p.development_dependencies = []
|
22
23
|
end
|
23
24
|
|
data/lib/to_csv.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
require 'csv'
|
2
|
-
|
3
1
|
class Array
|
2
|
+
require 'csv'
|
4
3
|
def to_csv(options = {}, csv_options = {})
|
5
4
|
return '' if self.empty?
|
6
5
|
|
@@ -17,9 +16,7 @@ class Array
|
|
17
16
|
|
18
17
|
return '' if columns.empty?
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
output = writer.generate(csv_options) do |csv|
|
19
|
+
output = CSV.generate(csv_options) do |csv|
|
23
20
|
csv << columns.map { |column| klass.human_attribute_name(column) } unless options[:headers] == false
|
24
21
|
self.each do |item|
|
25
22
|
csv << columns.collect { |column| item.send(column) }
|
data/tabularasa.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "tabularasa"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ary Djmal"]
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = "This Rails gem gives you the ability to call to_csv to a collection of activerecords"
|
11
11
|
s.email = "arydjmal@gmail.com"
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/to_csv.rb"]
|
13
|
-
s.files = ["MIT-LICENSE", "
|
13
|
+
s.files = ["MIT-LICENSE", "README.rdoc", "Rakefile", "init.rb", "lib/to_csv.rb", "tabularasa.gemspec", "test/test_helper.rb", "test/to_csv_test.rb", "Manifest"]
|
14
14
|
s.homepage = "https://github.com/arydjmal/to_csv"
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tabularasa", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
@@ -23,8 +23,11 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<ruby>, [">= 1.9"])
|
26
27
|
else
|
28
|
+
s.add_dependency(%q<ruby>, [">= 1.9"])
|
27
29
|
end
|
28
30
|
else
|
31
|
+
s.add_dependency(%q<ruby>, [">= 1.9"])
|
29
32
|
end
|
30
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabularasa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,18 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2011-11-23 00:00:00.000000000Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ruby
|
16
|
+
requirement: &3924680 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.9'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *3924680
|
14
25
|
description: This Rails gem gives you the ability to call to_csv to a collection of
|
15
26
|
activerecords
|
16
27
|
email: arydjmal@gmail.com
|
@@ -21,14 +32,14 @@ extra_rdoc_files:
|
|
21
32
|
- lib/to_csv.rb
|
22
33
|
files:
|
23
34
|
- MIT-LICENSE
|
24
|
-
- Manifest
|
25
35
|
- README.rdoc
|
26
36
|
- Rakefile
|
27
37
|
- init.rb
|
28
38
|
- lib/to_csv.rb
|
39
|
+
- tabularasa.gemspec
|
29
40
|
- test/test_helper.rb
|
30
41
|
- test/to_csv_test.rb
|
31
|
-
-
|
42
|
+
- Manifest
|
32
43
|
homepage: https://github.com/arydjmal/to_csv
|
33
44
|
licenses: []
|
34
45
|
post_install_message:
|