comma 4.2.0 → 4.3.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/.rubocop_todo.yml +3 -364
- data/.travis.yml +36 -55
- data/Appraisals +14 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +19 -16
- data/README.md +2 -2
- data/Rakefile +2 -0
- data/comma.gemspec +13 -11
- data/gemfiles/{active4.1.16.gemfile → active4.2.11.1.gemfile} +2 -2
- data/gemfiles/{active4.2.8.gemfile.lock → active4.2.11.1.gemfile.lock} +43 -38
- data/gemfiles/{active4.0.13.gemfile → active5.0.7.2.gemfile} +2 -2
- data/gemfiles/{active5.0.1.gemfile.lock → active5.0.7.2.gemfile.lock} +44 -40
- data/gemfiles/{active5.1.0.gemfile → active5.1.7.gemfile} +2 -2
- data/gemfiles/{active5.1.0.gemfile.lock → active5.1.7.gemfile.lock} +44 -40
- data/gemfiles/{active4.2.8.gemfile → active5.2.3.gemfile} +2 -2
- data/gemfiles/active5.2.3.gemfile.lock +108 -0
- data/gemfiles/{active5.0.1.gemfile → active6.0.0.gemfile} +2 -2
- data/gemfiles/{active5.2.0.gemfile.lock → active6.0.0.gemfile.lock} +31 -29
- data/gemfiles/{rails4.1.16.gemfile → rails4.2.11.1.gemfile} +1 -1
- data/gemfiles/{rails4.2.8.gemfile.lock → rails4.2.11.1.gemfile.lock} +84 -80
- data/gemfiles/{rails4.0.13.gemfile → rails5.0.7.2.gemfile} +1 -1
- data/gemfiles/rails5.0.7.2.gemfile.lock +198 -0
- data/gemfiles/{rails5.1.0.gemfile → rails5.1.7.gemfile} +1 -1
- data/gemfiles/rails5.1.7.gemfile.lock +198 -0
- data/gemfiles/{rails5.2.0.gemfile → rails5.2.3.gemfile} +1 -1
- data/gemfiles/{rails5.2.0.gemfile.lock → rails5.2.3.gemfile.lock} +82 -80
- data/gemfiles/{rails4.2.8.gemfile → rails6.0.0.gemfile} +1 -1
- data/gemfiles/rails6.0.0.gemfile.lock +237 -0
- data/init.rb +2 -0
- data/lib/comma.rb +23 -33
- data/lib/comma/array.rb +2 -0
- data/lib/comma/data_extractor.rb +5 -5
- data/lib/comma/data_mapper_collection.rb +9 -3
- data/lib/comma/extractor.rb +3 -5
- data/lib/comma/generator.rb +11 -11
- data/lib/comma/header_extractor.rb +18 -14
- data/lib/comma/mongoid.rb +10 -7
- data/lib/comma/object.rb +5 -1
- data/lib/comma/relation.rb +16 -10
- data/lib/comma/version.rb +3 -1
- data/spec/comma/comma_spec.rb +68 -47
- data/spec/comma/data_extractor_spec.rb +6 -10
- data/spec/comma/header_extractor_spec.rb +2 -8
- data/spec/comma/rails/active_record_spec.rb +28 -26
- data/spec/comma/rails/data_mapper_collection_spec.rb +4 -3
- data/spec/comma/rails/mongoid_spec.rb +8 -7
- data/spec/controllers/users_controller_spec.rb +48 -47
- data/spec/non_rails_app/ruby_classes.rb +13 -6
- data/spec/rails_app/active_record/config.rb +3 -1
- data/spec/rails_app/active_record/models.rb +4 -2
- data/spec/rails_app/data_mapper/config.rb +2 -0
- data/spec/rails_app/mongoid/config.rb +4 -2
- data/spec/rails_app/rails_app.rb +12 -11
- data/spec/rails_app/tmp/.gitkeep +0 -0
- data/spec/spec_helper.rb +7 -3
- metadata +27 -30
- data/gemfiles/active4.0.13.gemfile.lock +0 -107
- data/gemfiles/active4.1.16.gemfile.lock +0 -106
- data/gemfiles/active5.2.0.gemfile +0 -10
- data/gemfiles/rails4.0.13.gemfile.lock +0 -158
- data/gemfiles/rails4.1.16.gemfile.lock +0 -162
- data/gemfiles/rails5.0.1.gemfile +0 -11
- data/gemfiles/rails5.0.1.gemfile.lock +0 -194
- data/gemfiles/rails5.1.0.gemfile.lock +0 -194
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'comma/extractor'
|
2
4
|
require 'active_support/core_ext/class/attribute'
|
3
5
|
require 'active_support/core_ext/date_time/conversions'
|
@@ -6,44 +8,46 @@ require 'active_support/core_ext/string/inflections'
|
|
6
8
|
|
7
9
|
module Comma
|
8
10
|
class HeaderExtractor < Extractor
|
9
|
-
|
10
11
|
class_attribute :value_humanizer
|
11
12
|
|
12
|
-
DEFAULT_VALUE_HUMANIZER = lambda do |value,
|
13
|
+
DEFAULT_VALUE_HUMANIZER = lambda do |value, _model_class|
|
13
14
|
value.is_a?(String) ? value : value.to_s.humanize
|
14
15
|
end
|
15
16
|
self.value_humanizer = DEFAULT_VALUE_HUMANIZER
|
16
17
|
|
17
|
-
def method_missing(sym, *args, &
|
18
|
+
def method_missing(sym, *args, &_block)
|
18
19
|
model_class = @instance.class
|
19
|
-
@results <<
|
20
|
+
@results << value_humanizer.call(sym, model_class) if args.blank?
|
20
21
|
args.each do |arg|
|
21
22
|
case arg
|
22
23
|
when Hash
|
23
|
-
arg.each do |
|
24
|
-
@results <<
|
24
|
+
arg.each do |_k, v|
|
25
|
+
@results << value_humanizer.call(v, get_association_class(model_class, sym))
|
25
26
|
end
|
26
27
|
when Symbol
|
27
|
-
@results <<
|
28
|
+
@results << value_humanizer.call(arg, get_association_class(model_class, sym))
|
28
29
|
when String
|
29
|
-
@results <<
|
30
|
+
@results << value_humanizer.call(arg, model_class)
|
30
31
|
else
|
31
32
|
raise "Unknown header symbol #{arg.inspect}"
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
def __static_column__(header = '', &
|
37
|
+
def __static_column__(header = '', &_block)
|
37
38
|
@results << header
|
38
39
|
end
|
39
40
|
|
40
41
|
private
|
41
42
|
|
42
|
-
def get_association_class(model_class, association)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
def get_association_class(model_class, association)
|
44
|
+
return unless model_class.respond_to?(:reflect_on_association)
|
45
|
+
|
46
|
+
begin
|
47
|
+
model_class.reflect_on_association(association)&.klass
|
48
|
+
rescue NameError
|
49
|
+
nil
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
data/lib/comma/mongoid.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Conditionally set to_comma on Mongoid records if mongoid gem is installed
|
2
4
|
begin
|
3
5
|
require 'mongoid'
|
4
|
-
|
5
|
-
|
6
|
-
|
6
|
+
|
7
|
+
module Mongoid
|
8
|
+
class Criteria
|
9
|
+
def to_comma(style = :default)
|
10
|
+
Comma::Generator.new(self, style).run(:each)
|
11
|
+
end
|
7
12
|
end
|
8
13
|
end
|
9
|
-
rescue LoadError
|
14
|
+
rescue LoadError # rubocop:disable Lint/HandleExceptions
|
10
15
|
end
|
11
|
-
|
12
|
-
|
data/lib/comma/object.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'comma/data_extractor'
|
2
4
|
require 'comma/header_extractor'
|
3
5
|
|
@@ -31,6 +33,8 @@ class Object
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def raise_unless_style_exists(style)
|
34
|
-
|
36
|
+
return if self.comma_formats && self.comma_formats[style]
|
37
|
+
|
38
|
+
raise "No comma format for class #{self.class} defined for style #{style}"
|
35
39
|
end
|
36
40
|
end
|
data/lib/comma/relation.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
class Relation
|
5
|
+
def to_comma(style = :default)
|
6
|
+
iterator_method =
|
7
|
+
if arel.ast.limit || !arel.ast.orders.empty?
|
8
|
+
Rails.logger.warn { <<~WARN } if defined?(Rails)
|
9
|
+
#to_comma is being used on a relation with limit or order clauses. Falling back to iterating with :each. This can cause performance issues.
|
10
|
+
WARN
|
11
|
+
:each
|
12
|
+
else
|
13
|
+
:find_each
|
14
|
+
end
|
15
|
+
Comma::Generator.new(self, style).run(iterator_method)
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
data/lib/comma/version.rb
CHANGED
data/spec/comma/comma_spec.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
4
|
|
3
5
|
describe Comma do
|
4
|
-
|
5
6
|
it 'should extend object to add a comma method' do
|
6
7
|
expect(Object).to respond_to(:comma)
|
7
8
|
end
|
@@ -30,7 +31,6 @@ describe Comma do
|
|
30
31
|
end
|
31
32
|
|
32
33
|
describe Comma, 'generating CSV' do # rubocop:disable Metrics/BlockLength
|
33
|
-
|
34
34
|
before do
|
35
35
|
@isbn = Isbn.new('123123123', '321321321')
|
36
36
|
@book = Book.new('Smalltalk-80', 'Language and Implementation', @isbn)
|
@@ -40,53 +40,54 @@ describe Comma, 'generating CSV' do # rubocop:disable Metrics/BlockLength
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should extend Array to add a #to_comma method which will return CSV content for objects within the array' do
|
43
|
-
|
43
|
+
expected = "Title,Description,Issuer,ISBN-10,ISBN-13\nSmalltalk-80,Language and Implementation,ISBN,123123123,321321321\n" # rubocop:disable Metrics/LineLength
|
44
|
+
expect(@books.to_comma).to eq(expected)
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'should return an empty string when generating CSV from an empty array' do
|
47
|
-
expect(
|
48
|
+
expect([].to_comma).to eq('')
|
48
49
|
end
|
49
50
|
|
50
|
-
it
|
51
|
+
it 'should change the style when specified' do
|
51
52
|
expect(@books.to_comma(:brief)).to eq("Name,Description\nSmalltalk-80,Language and Implementation\n")
|
52
53
|
end
|
53
54
|
|
54
55
|
describe 'with :filename specified' do
|
55
|
-
after{ File.delete('comma.csv') }
|
56
|
+
after { File.delete('comma.csv') }
|
56
57
|
|
57
|
-
it
|
58
|
-
@books.to_comma(:
|
59
|
-
|
58
|
+
it 'should write to the file' do
|
59
|
+
@books.to_comma(filename: 'comma.csv')
|
60
|
+
expected = "Title,Description,Issuer,ISBN-10,ISBN-13\nSmalltalk-80,Language and Implementation,ISBN,123123123,321321321\n" # rubocop:disable Metrics/LineLength
|
61
|
+
expect(File.read('comma.csv')).to eq(expected)
|
60
62
|
end
|
61
63
|
|
62
|
-
it
|
63
|
-
@books.to_comma(:
|
64
|
-
|
64
|
+
it 'should accept FasterCSV options' do
|
65
|
+
@books.to_comma(filename: 'comma.csv', col_sep: ';', force_quotes: true)
|
66
|
+
expected = "\"Title\";\"Description\";\"Issuer\";\"ISBN-10\";\"ISBN-13\"\n\"Smalltalk-80\";\"Language and Implementation\";\"ISBN\";\"123123123\";\"321321321\"\n" # rubocop:disable Metrics/LineLength
|
67
|
+
expect(File.read('comma.csv')).to eq(expected)
|
65
68
|
end
|
66
|
-
|
67
69
|
end
|
68
70
|
|
69
|
-
describe
|
70
|
-
it
|
71
|
-
|
71
|
+
describe 'with FasterCSV options' do
|
72
|
+
it 'should not change when options are empty' do
|
73
|
+
expected = "Title,Description,Issuer,ISBN-10,ISBN-13\nSmalltalk-80,Language and Implementation,ISBN,123123123,321321321\n" # rubocop:disable Metrics/LineLength
|
74
|
+
expect(@books.to_comma({})).to eq(expected)
|
72
75
|
end
|
73
76
|
|
74
77
|
it 'should accept the options in #to_comma and generate the appropriate CSV' do
|
75
|
-
|
76
|
-
|
78
|
+
expected = "\"Title\";\"Description\";\"Issuer\";\"ISBN-10\";\"ISBN-13\"\n\"Smalltalk-80\";\"Language and Implementation\";\"ISBN\";\"123123123\";\"321321321\"\n" # rubocop:disable Metrics/LineLength
|
79
|
+
expect(@books.to_comma(col_sep: ';', force_quotes: true)).to eq(expected)
|
77
80
|
end
|
78
81
|
|
79
|
-
it
|
80
|
-
expect(@books.to_comma(:
|
82
|
+
it 'should change the style when specified' do
|
83
|
+
expect(@books.to_comma(style: :brief, col_sep: ';', force_quotes: true))
|
81
84
|
.to eq("\"Name\";\"Description\"\n\"Smalltalk-80\";\"Language and Implementation\"\n")
|
82
85
|
end
|
83
86
|
end
|
84
87
|
end
|
85
88
|
|
86
89
|
describe Comma, 'defining CSV descriptions' do
|
87
|
-
|
88
90
|
describe 'with an unnamed description' do
|
89
|
-
|
90
91
|
before do
|
91
92
|
class Foo
|
92
93
|
comma do; end
|
@@ -100,7 +101,6 @@ describe Comma, 'defining CSV descriptions' do
|
|
100
101
|
end
|
101
102
|
|
102
103
|
describe 'with a named description' do
|
103
|
-
|
104
104
|
before do
|
105
105
|
class Bar
|
106
106
|
comma do; end
|
@@ -117,9 +117,7 @@ describe Comma, 'defining CSV descriptions' do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
describe Comma, 'to_comma data/headers object extensions' do # rubocop:disable Metrics/BlockLength
|
120
|
-
|
121
120
|
describe 'with unnamed descriptions' do
|
122
|
-
|
123
121
|
before do
|
124
122
|
class Foo
|
125
123
|
attr_accessor :content
|
@@ -144,11 +142,9 @@ describe Comma, 'to_comma data/headers object extensions' do # rubocop:disable M
|
|
144
142
|
it 'should return the CSV representation including header and content when called on an array' do
|
145
143
|
expect(Array(@foo).to_comma).to eq("Content\ncontent\n")
|
146
144
|
end
|
147
|
-
|
148
145
|
end
|
149
146
|
|
150
147
|
describe 'with named descriptions' do
|
151
|
-
|
152
148
|
before do
|
153
149
|
class Foo
|
154
150
|
attr_accessor :content
|
@@ -179,7 +175,6 @@ describe Comma, 'to_comma data/headers object extensions' do # rubocop:disable M
|
|
179
175
|
expect { @foo.to_comma_headers(:bad) }.to raise_error
|
180
176
|
expect { Array(@foo).to_comma(:bad) }.to raise_error
|
181
177
|
end
|
182
|
-
|
183
178
|
end
|
184
179
|
|
185
180
|
describe 'with block' do # rubocop:disable BlockLength
|
@@ -188,11 +183,11 @@ describe Comma, 'to_comma data/headers object extensions' do # rubocop:disable M
|
|
188
183
|
attr_accessor :content, :created_at, :updated_at
|
189
184
|
comma do
|
190
185
|
content
|
191
|
-
content('Truncated Content') {|i| i && i.length > 10 ? i[0..10] : '---' }
|
192
|
-
created_at { |i| i
|
193
|
-
updated_at { |i| i
|
194
|
-
created_at 'Created Custom Label' do |i| i
|
195
|
-
updated_at 'Updated at Custom Label' do |i| i
|
186
|
+
content('Truncated Content') { |i| i && i.length > 10 ? i[0..10] : '---' }
|
187
|
+
created_at { |i| i&.to_s(:db) }
|
188
|
+
updated_at { |i| i&.to_s(:db) }
|
189
|
+
created_at 'Created Custom Label' do |i| i&.to_s(:short) end
|
190
|
+
updated_at 'Updated at Custom Label' do |i| i&.to_s(:short) end
|
196
191
|
end
|
197
192
|
|
198
193
|
def initialize(content, created_at = Time.now, updated_at = Time.now)
|
@@ -209,38 +204,66 @@ describe Comma, 'to_comma data/headers object extensions' do # rubocop:disable M
|
|
209
204
|
|
210
205
|
it 'should return yielded values by block' do
|
211
206
|
_header, foo = Array(@foo).to_comma.split("\n")
|
212
|
-
|
207
|
+
expected = [
|
208
|
+
@content,
|
209
|
+
@content[0..10],
|
210
|
+
@time.to_s(:db),
|
211
|
+
@time.to_s(:db),
|
212
|
+
@time.to_s(:short),
|
213
|
+
@time.to_s(:short)
|
214
|
+
].join(',')
|
215
|
+
expect(foo).to eq(expected)
|
213
216
|
end
|
214
217
|
|
215
218
|
it 'should return headers with custom labels from block' do
|
216
219
|
header, _foo = Array(@foo).to_comma.split("\n")
|
217
|
-
|
220
|
+
expected = [
|
221
|
+
'Content',
|
222
|
+
'Truncated Content',
|
223
|
+
'Created at',
|
224
|
+
'Updated at',
|
225
|
+
'Created Custom Label',
|
226
|
+
'Updated at Custom Label'
|
227
|
+
].join(',')
|
228
|
+
expect(header).to eq(expected)
|
218
229
|
end
|
219
230
|
|
220
231
|
it 'should put headers in place when forced' do
|
221
|
-
header, _foo = Array(@foo).to_comma(:
|
222
|
-
|
232
|
+
header, _foo = Array(@foo).to_comma(write_headers: true).split("\n")
|
233
|
+
expected = [
|
234
|
+
'Content',
|
235
|
+
'Truncated Content',
|
236
|
+
'Created at',
|
237
|
+
'Updated at',
|
238
|
+
'Created Custom Label',
|
239
|
+
'Updated at Custom Label'
|
240
|
+
].join(',')
|
241
|
+
expect(header).to eq(expected)
|
223
242
|
end
|
224
243
|
|
225
244
|
it 'should not write headers if specified' do
|
226
|
-
header, _foo = Array(@foo).to_comma(:
|
227
|
-
|
245
|
+
header, _foo = Array(@foo).to_comma(write_headers: false).split("\n")
|
246
|
+
expected = [
|
247
|
+
@content,
|
248
|
+
@content[0..10],
|
249
|
+
@time.to_s(:db),
|
250
|
+
@time.to_s(:db),
|
251
|
+
@time.to_s(:short),
|
252
|
+
@time.to_s(:short)
|
253
|
+
].join(',')
|
254
|
+
expect(header).to eq(expected)
|
228
255
|
end
|
229
|
-
|
230
256
|
end
|
231
257
|
|
232
|
-
|
233
258
|
describe 'on an object with no comma declaration' do
|
234
|
-
|
235
259
|
it 'should raise an error mentioning there is no comma description defined for that class' do
|
236
260
|
expect { 'a string'.to_comma }.to raise_error('No comma format for class String defined for style default')
|
237
|
-
expect { 'a string'.to_comma_headers }
|
261
|
+
expect { 'a string'.to_comma_headers }
|
262
|
+
.to raise_error('No comma format for class String defined for style default')
|
238
263
|
end
|
239
|
-
|
240
264
|
end
|
241
265
|
|
242
266
|
describe 'on objects using Single Table Inheritance' do
|
243
|
-
|
244
267
|
before do
|
245
268
|
class MySuperClass
|
246
269
|
attr_accessor :content
|
@@ -273,9 +296,7 @@ describe Comma, 'to_comma data/headers object extensions' do # rubocop:disable M
|
|
273
296
|
it 'should return and array of data content, as defined in comma block in super class, if not present in child' do
|
274
297
|
expect(@childNoComma.to_comma).to eq(%w[super-content])
|
275
298
|
end
|
276
|
-
|
277
299
|
end
|
278
|
-
|
279
300
|
end
|
280
301
|
|
281
302
|
describe Comma, '__use__ keyword' do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
# comma do
|
@@ -8,7 +10,6 @@ require 'spec_helper'
|
|
8
10
|
# end
|
9
11
|
|
10
12
|
describe Comma::DataExtractor do # rubocop:disable Metrics/BlockLength
|
11
|
-
|
12
13
|
before do
|
13
14
|
@isbn = Isbn.new('123123123', '321321321')
|
14
15
|
@book = Book.new('Smalltalk-80', 'Language and Implementation', @isbn)
|
@@ -17,41 +18,36 @@ describe Comma::DataExtractor do # rubocop:disable Metrics/BlockLength
|
|
17
18
|
end
|
18
19
|
|
19
20
|
describe 'when no parameters are provided' do
|
20
|
-
|
21
21
|
it 'should use the string value returned by sending the method name on the object' do
|
22
22
|
@data.should include('Language and Implementation')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe 'when given a string description as a parameter' do
|
27
|
-
|
28
27
|
it 'should use the string value returned by sending the method name on the object' do
|
29
28
|
@data.should include('Smalltalk-80')
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
32
|
describe 'when an hash is passed as a parameter' do
|
34
|
-
|
35
33
|
describe 'with a string value' do
|
36
|
-
|
37
34
|
it 'should use the string value, returned by sending the hash key to the object' do
|
38
35
|
@data.should include('123123123')
|
39
36
|
@data.should include('321321321')
|
40
37
|
end
|
41
38
|
|
42
39
|
it 'should not fail when an associated object is nil' do
|
43
|
-
|
40
|
+
-> { Book.new('Smalltalk-80', 'Language and Implementation', nil).to_comma }.should_not raise_error
|
44
41
|
end
|
45
42
|
end
|
46
43
|
end
|
47
|
-
|
48
44
|
end
|
49
45
|
|
50
46
|
describe Comma::DataExtractor, 'id attribute' do
|
51
47
|
before do
|
52
48
|
@data = Class.new(Struct.new(:id)) do
|
53
49
|
comma do
|
54
|
-
id 'ID' do |
|
50
|
+
id 'ID' do |_id| '42' end
|
55
51
|
end
|
56
52
|
end.new(1).to_comma
|
57
53
|
end
|
@@ -68,7 +64,7 @@ describe Comma::DataExtractor, 'with static column method' do
|
|
68
64
|
__static_column__
|
69
65
|
__static_column__ 'STATIC'
|
70
66
|
__static_column__ 'STATIC' do '' end
|
71
|
-
__static_column__ 'STATIC'
|
67
|
+
__static_column__ 'STATIC', &:name
|
72
68
|
end
|
73
69
|
end.new(1, 'John Doe').to_comma
|
74
70
|
end
|
@@ -84,7 +80,7 @@ describe Comma::DataExtractor, 'nil value' do
|
|
84
80
|
comma do
|
85
81
|
name
|
86
82
|
name 'Name'
|
87
|
-
name 'Name' do |
|
83
|
+
name 'Name' do |_name| nil end
|
88
84
|
end
|
89
85
|
end.new(1, nil).to_comma
|
90
86
|
end
|