tabularasa 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +4 -0
- data/README.rdoc +1 -1
- data/Rakefile +3 -2
- data/lib/tabularasa.rb +5 -2
- data/tabularasa.gemspec +21 -14
- data/test/active_record.rb +0 -0
- data/test/array.rb +0 -0
- data/test/hash.rb +17 -0
- data/test/test_helper.rb +8 -0
- metadata +74 -26
data/Manifest
CHANGED
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'echoe'
|
3
3
|
|
4
|
-
Echoe.new('tabularasa', '0.2.
|
4
|
+
Echoe.new('tabularasa', '0.2.1') do |p|
|
5
5
|
p.summary = "Gives the ability to convert homogeneous activerecord and/or hash objects into csv"
|
6
6
|
p.description = "This Rails gem gives you the ability to call to_csv to a collection of homogenous activerecords and/or hashes"
|
7
7
|
p.url = "https://github.com/callenrosario/tabularasa"
|
8
8
|
p.author = "Chris Rosario"
|
9
9
|
p.email = "callenrosario@gmail.com"
|
10
10
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
-
p.runtime_dependencies = []
|
11
|
+
p.runtime_dependencies = ['activerecord']
|
12
|
+
p.runtime_dependencies << 'fastercsv' if RUBY_VERSION < '1.9'
|
12
13
|
p.development_dependencies = []
|
13
14
|
end
|
14
15
|
|
data/lib/tabularasa.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_record'
|
2
|
+
require RUBY_VERSION >= '1.9' ? 'csv' : 'fastercsv'
|
2
3
|
|
3
4
|
class Tabularasa
|
4
5
|
def initialize(rows, options = {}, &block)
|
6
|
+
@generator = RUBY_VERSION >= '1.9' ? CSV : FasterCSV
|
7
|
+
@delimiter = options[:delimiter] || ','
|
5
8
|
@rows = rows
|
6
9
|
@keys = (options[:only] || get_keys) - (options[:exclude] || [])
|
7
10
|
@headers = options[:headers] || options[:only] || get_headers
|
8
11
|
end
|
9
12
|
|
10
13
|
def to_csv
|
11
|
-
csv_data =
|
14
|
+
csv_data = @generator.generate(:col_sep => @delimiter) do |csv|
|
12
15
|
csv << @headers
|
13
16
|
@rows.each do |row|
|
14
17
|
csv << collect(row)
|
data/tabularasa.gemspec
CHANGED
@@ -1,29 +1,36 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "0.2.
|
4
|
+
s.name = %q{tabularasa}
|
5
|
+
s.version = "0.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = [
|
9
|
-
s.date =
|
10
|
-
s.description =
|
11
|
-
s.email =
|
12
|
-
s.extra_rdoc_files = [
|
13
|
-
s.files = [
|
14
|
-
s.homepage =
|
15
|
-
s.rdoc_options = [
|
16
|
-
s.require_paths = [
|
17
|
-
s.rubyforge_project =
|
18
|
-
s.rubygems_version =
|
19
|
-
s.summary =
|
8
|
+
s.authors = [%q{Chris Rosario}]
|
9
|
+
s.date = %q{2011-11-29}
|
10
|
+
s.description = %q{This Rails gem gives you the ability to call to_csv to a collection of homogenous activerecords and/or hashes}
|
11
|
+
s.email = %q{callenrosario@gmail.com}
|
12
|
+
s.extra_rdoc_files = [%q{README.rdoc}, %q{lib/tabularasa.rb}]
|
13
|
+
s.files = [%q{MIT-LICENSE}, %q{README.rdoc}, %q{Rakefile}, %q{init.rb}, %q{lib/tabularasa.rb}, %q{test/active_record.rb}, %q{test/array.rb}, %q{test/hash.rb}, %q{test/test_helper.rb}, %q{Manifest}, %q{tabularasa.gemspec}]
|
14
|
+
s.homepage = %q{https://github.com/callenrosario/tabularasa}
|
15
|
+
s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Tabularasa}, %q{--main}, %q{README.rdoc}]
|
16
|
+
s.require_paths = [%q{lib}]
|
17
|
+
s.rubyforge_project = %q{tabularasa}
|
18
|
+
s.rubygems_version = %q{1.8.6}
|
19
|
+
s.summary = %q{Gives the ability to convert homogeneous activerecord and/or hash objects into csv}
|
20
|
+
s.test_files = [%q{test/test_helper.rb}]
|
20
21
|
|
21
22
|
if s.respond_to? :specification_version then
|
22
23
|
s.specification_version = 3
|
23
24
|
|
24
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<activerecord>, [">= 0"])
|
27
|
+
s.add_runtime_dependency(%q<fastercsv>, [">= 0"])
|
25
28
|
else
|
29
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
30
|
+
s.add_dependency(%q<fastercsv>, [">= 0"])
|
26
31
|
end
|
27
32
|
else
|
33
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
34
|
+
s.add_dependency(%q<fastercsv>, [">= 0"])
|
28
35
|
end
|
29
36
|
end
|
File without changes
|
data/test/array.rb
ADDED
File without changes
|
data/test/hash.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,61 +1,109 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabularasa
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Chris Rosario
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
|
18
|
+
date: 2011-11-29 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: activerecord
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: fastercsv
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
description: This Rails gem gives you the ability to call to_csv to a collection of homogenous activerecords and/or hashes
|
16
49
|
email: callenrosario@gmail.com
|
17
50
|
executables: []
|
51
|
+
|
18
52
|
extensions: []
|
19
|
-
|
53
|
+
|
54
|
+
extra_rdoc_files:
|
20
55
|
- README.rdoc
|
21
56
|
- lib/tabularasa.rb
|
22
|
-
files:
|
57
|
+
files:
|
23
58
|
- MIT-LICENSE
|
24
59
|
- README.rdoc
|
25
60
|
- Rakefile
|
26
61
|
- init.rb
|
27
62
|
- lib/tabularasa.rb
|
63
|
+
- test/active_record.rb
|
64
|
+
- test/array.rb
|
65
|
+
- test/hash.rb
|
66
|
+
- test/test_helper.rb
|
28
67
|
- Manifest
|
29
68
|
- tabularasa.gemspec
|
30
69
|
homepage: https://github.com/callenrosario/tabularasa
|
31
70
|
licenses: []
|
71
|
+
|
32
72
|
post_install_message:
|
33
|
-
rdoc_options:
|
73
|
+
rdoc_options:
|
34
74
|
- --line-numbers
|
35
75
|
- --inline-source
|
36
76
|
- --title
|
37
77
|
- Tabularasa
|
38
78
|
- --main
|
39
79
|
- README.rdoc
|
40
|
-
require_paths:
|
80
|
+
require_paths:
|
41
81
|
- lib
|
42
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
83
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
|
48
|
-
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
92
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 11
|
97
|
+
segments:
|
98
|
+
- 1
|
99
|
+
- 2
|
100
|
+
version: "1.2"
|
54
101
|
requirements: []
|
102
|
+
|
55
103
|
rubyforge_project: tabularasa
|
56
|
-
rubygems_version: 1.8.
|
104
|
+
rubygems_version: 1.8.6
|
57
105
|
signing_key:
|
58
106
|
specification_version: 3
|
59
|
-
summary: Gives the ability to convert homogeneous activerecord and/or hash objects
|
60
|
-
|
61
|
-
|
107
|
+
summary: Gives the ability to convert homogeneous activerecord and/or hash objects into csv
|
108
|
+
test_files:
|
109
|
+
- test/test_helper.rb
|