comma 3.2.3 → 3.2.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/Gemfile.lock +1 -1
- data/gemfiles/active3.0.20.gemfile.lock +1 -1
- data/gemfiles/active3.1.12.gemfile.lock +1 -1
- data/gemfiles/active3.2.20.gemfile.lock +1 -1
- data/gemfiles/active4.0.13.gemfile.lock +1 -1
- data/gemfiles/active4.1.10.gemfile.lock +1 -1
- data/gemfiles/active4.2.1.gemfile.lock +1 -1
- data/gemfiles/data_mapper1.2.0.gemfile.lock +1 -1
- data/gemfiles/mongoid3.1.6.gemfile.lock +1 -1
- data/gemfiles/rails3.0.20.gemfile.lock +1 -1
- data/gemfiles/rails3.1.12.gemfile.lock +1 -1
- data/gemfiles/rails3.2.20.gemfile.lock +1 -1
- data/gemfiles/rails4.0.13.gemfile.lock +1 -1
- data/gemfiles/rails4.1.10.gemfile.lock +1 -1
- data/gemfiles/rails4.2.1.gemfile.lock +1 -1
- data/lib/comma/object.rb +8 -13
- data/lib/comma/version.rb +1 -1
- data/spec/comma/comma_spec.rb +2 -1
- data/spec/comma/rails/active_record_spec.rb +9 -3
- metadata +111 -80
- checksums.yaml +0 -7
data/Gemfile.lock
CHANGED
data/lib/comma/object.rb
CHANGED
@@ -3,19 +3,16 @@ require 'comma/data_extractor'
|
|
3
3
|
require 'comma/header_extractor'
|
4
4
|
|
5
5
|
class Object
|
6
|
+
class_attribute :comma_formats
|
7
|
+
|
6
8
|
class << self
|
7
9
|
def comma(style = :default, &block)
|
8
|
-
(
|
10
|
+
(self.comma_formats ||= {})[style] = block
|
9
11
|
end
|
10
12
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
{}
|
15
|
-
else
|
16
|
-
self.superclass.comma_formats
|
17
|
-
end
|
18
|
-
end
|
13
|
+
def inherited(subclass)
|
14
|
+
super
|
15
|
+
subclass.comma_formats = self.comma_formats ? self.comma_formats.dup : {}
|
19
16
|
end
|
20
17
|
end
|
21
18
|
|
@@ -31,12 +28,10 @@ class Object
|
|
31
28
|
|
32
29
|
def extract_with(extractor_class, style = :default)
|
33
30
|
raise_unless_style_exists(style)
|
34
|
-
|
35
|
-
extractor_class.new(self, style, formats).results
|
31
|
+
extractor_class.new(self, style, self.comma_formats).results
|
36
32
|
end
|
37
33
|
|
38
34
|
def raise_unless_style_exists(style)
|
39
|
-
|
40
|
-
raise "No comma format for class #{self.class} defined for style #{style}" unless formats && formats[style]
|
35
|
+
raise "No comma format for class #{self.class} defined for style #{style}" unless self.comma_formats && self.comma_formats[style]
|
41
36
|
end
|
42
37
|
end
|
data/lib/comma/version.rb
CHANGED
data/spec/comma/comma_spec.rb
CHANGED
@@ -150,13 +150,17 @@ if defined? ActiveRecord
|
|
150
150
|
end
|
151
151
|
|
152
152
|
describe Comma, 'generating CSV from an ActiveRecord object using Single Table Inheritance' do
|
153
|
-
|
154
153
|
class Animal < ActiveRecord::Base
|
155
|
-
comma do
|
154
|
+
comma do
|
156
155
|
name 'Name' do |name|
|
157
156
|
'Super-' + name
|
158
157
|
end
|
159
158
|
end
|
159
|
+
|
160
|
+
comma :with_type do
|
161
|
+
name
|
162
|
+
type
|
163
|
+
end
|
160
164
|
end
|
161
165
|
|
162
166
|
class Dog < Animal
|
@@ -192,6 +196,8 @@ if defined? ActiveRecord
|
|
192
196
|
@cat.to_comma.should == %w(Super-Kitty)
|
193
197
|
end
|
194
198
|
|
199
|
+
it 'should call definion in parent class' do
|
200
|
+
lambda { @dog.to_comma(:with_type) }.should_not raise_error
|
201
|
+
end
|
195
202
|
end
|
196
|
-
|
197
203
|
end
|
metadata
CHANGED
@@ -1,98 +1,119 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: comma
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 3
|
8
|
+
- 2
|
9
|
+
- 4
|
10
|
+
version: 3.2.4
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
12
|
+
authors:
|
7
13
|
- Marcus Crafter
|
8
14
|
- Tom Meier
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
|
19
|
+
date: 2015-04-08 00:00:00 +09:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
18
26
|
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 7
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 0
|
32
|
+
- 0
|
20
33
|
version: 3.0.0
|
21
34
|
type: :runtime
|
35
|
+
version_requirements: *id001
|
22
36
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
37
|
+
name: activesupport
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 13
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 4
|
48
|
+
- 1
|
34
49
|
version: 0.4.1
|
35
50
|
type: :development
|
51
|
+
version_requirements: *id002
|
36
52
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
53
|
+
name: appraisal
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 63
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
- 9
|
64
|
+
- 2
|
48
65
|
version: 0.9.2
|
49
66
|
type: :development
|
67
|
+
version_requirements: *id003
|
50
68
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
69
|
+
name: rake
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 47
|
77
|
+
segments:
|
78
|
+
- 2
|
79
|
+
- 8
|
80
|
+
- 0
|
62
81
|
version: 2.8.0
|
63
82
|
type: :development
|
83
|
+
version_requirements: *id004
|
64
84
|
prerelease: false
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
85
|
+
name: rspec
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 19
|
93
|
+
segments:
|
94
|
+
- 1
|
95
|
+
- 3
|
96
|
+
- 4
|
76
97
|
version: 1.3.4
|
77
98
|
type: :development
|
99
|
+
version_requirements: *id005
|
78
100
|
prerelease: false
|
79
|
-
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 1.3.4
|
101
|
+
name: sqlite3
|
84
102
|
description: Ruby Comma Seperated Values generation library
|
85
|
-
email:
|
103
|
+
email:
|
86
104
|
- crafterm@redartisan.com
|
87
105
|
- tom@venombytes.com
|
88
106
|
executables: []
|
107
|
+
|
89
108
|
extensions: []
|
109
|
+
|
90
110
|
extra_rdoc_files: []
|
91
|
-
|
92
|
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
111
|
+
|
112
|
+
files:
|
113
|
+
- .coveralls.yml
|
114
|
+
- .gitignore
|
115
|
+
- .rspec
|
116
|
+
- .travis.yml
|
96
117
|
- Appraisals
|
97
118
|
- Gemfile
|
98
119
|
- Gemfile.lock
|
@@ -154,31 +175,41 @@ files:
|
|
154
175
|
- spec/rails_app/mongoid/config.rb
|
155
176
|
- spec/rails_app/rails_app.rb
|
156
177
|
- spec/spec_helper.rb
|
178
|
+
has_rdoc: true
|
157
179
|
homepage: http://github.com/crafterm/comma
|
158
|
-
licenses:
|
180
|
+
licenses:
|
159
181
|
- MIT
|
160
|
-
metadata: {}
|
161
182
|
post_install_message:
|
162
183
|
rdoc_options: []
|
163
|
-
|
184
|
+
|
185
|
+
require_paths:
|
164
186
|
- lib
|
165
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
-
|
187
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
189
|
+
requirements:
|
167
190
|
- - ">="
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
|
170
|
-
|
171
|
-
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
hash: 3
|
193
|
+
segments:
|
194
|
+
- 0
|
195
|
+
version: "0"
|
196
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
|
+
none: false
|
198
|
+
requirements:
|
172
199
|
- - ">="
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
hash: 3
|
202
|
+
segments:
|
203
|
+
- 0
|
204
|
+
version: "0"
|
175
205
|
requirements: []
|
206
|
+
|
176
207
|
rubyforge_project: comma
|
177
|
-
rubygems_version:
|
208
|
+
rubygems_version: 1.6.2
|
178
209
|
signing_key:
|
179
|
-
specification_version:
|
210
|
+
specification_version: 3
|
180
211
|
summary: Ruby Comma Seperated Values generation library
|
181
|
-
test_files:
|
212
|
+
test_files:
|
182
213
|
- spec/comma/comma_spec.rb
|
183
214
|
- spec/comma/data_extractor_spec.rb
|
184
215
|
- spec/comma/header_extractor_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: ca042f6a9bdf1e47e62d1829ae1cc6aca549eb2f
|
4
|
-
data.tar.gz: 47882ea5eaa37cc7573e78bfaff111b666c162ae
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: f1e3d9ce1e135e3b5d45c2b1ac38c6a8d65f1811ed3a98a082a6050eab8bc413417e022457dd154db5877305d52fa277c1194ed3336ddedc05ed80698da66b80
|
7
|
-
data.tar.gz: 3515fae45105eb8b688071fbd03e2e2b9b1d594551772f09c7c4decce1c43455123ae59930ac4b2623d3313344b4f84e4751208b1d188b5841561f78506e057b
|