active_model_exporters 0.5.1 → 0.7.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.
@@ -0,0 +1,190 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_model_exporters (0.7.0)
5
+ rails (>= 6.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (7.0.3.1)
11
+ actionpack (= 7.0.3.1)
12
+ activesupport (= 7.0.3.1)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (7.0.3.1)
16
+ actionpack (= 7.0.3.1)
17
+ activejob (= 7.0.3.1)
18
+ activerecord (= 7.0.3.1)
19
+ activestorage (= 7.0.3.1)
20
+ activesupport (= 7.0.3.1)
21
+ mail (>= 2.7.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.3.1)
26
+ actionpack (= 7.0.3.1)
27
+ actionview (= 7.0.3.1)
28
+ activejob (= 7.0.3.1)
29
+ activesupport (= 7.0.3.1)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ rails-dom-testing (~> 2.0)
35
+ actionpack (7.0.3.1)
36
+ actionview (= 7.0.3.1)
37
+ activesupport (= 7.0.3.1)
38
+ rack (~> 2.0, >= 2.2.0)
39
+ rack-test (>= 0.6.3)
40
+ rails-dom-testing (~> 2.0)
41
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
+ actiontext (7.0.3.1)
43
+ actionpack (= 7.0.3.1)
44
+ activerecord (= 7.0.3.1)
45
+ activestorage (= 7.0.3.1)
46
+ activesupport (= 7.0.3.1)
47
+ globalid (>= 0.6.0)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (7.0.3.1)
50
+ activesupport (= 7.0.3.1)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.4)
53
+ rails-dom-testing (~> 2.0)
54
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
+ activejob (7.0.3.1)
56
+ activesupport (= 7.0.3.1)
57
+ globalid (>= 0.3.6)
58
+ activemodel (7.0.3.1)
59
+ activesupport (= 7.0.3.1)
60
+ activerecord (7.0.3.1)
61
+ activemodel (= 7.0.3.1)
62
+ activesupport (= 7.0.3.1)
63
+ activestorage (7.0.3.1)
64
+ actionpack (= 7.0.3.1)
65
+ activejob (= 7.0.3.1)
66
+ activerecord (= 7.0.3.1)
67
+ activesupport (= 7.0.3.1)
68
+ marcel (~> 1.0)
69
+ mini_mime (>= 1.1.0)
70
+ activesupport (7.0.3.1)
71
+ concurrent-ruby (~> 1.0, >= 1.0.2)
72
+ i18n (>= 1.6, < 2)
73
+ minitest (>= 5.1)
74
+ tzinfo (~> 2.0)
75
+ appraisal (2.4.1)
76
+ bundler
77
+ rake
78
+ thor (>= 0.14.0)
79
+ builder (3.2.4)
80
+ concurrent-ruby (1.1.10)
81
+ coveralls (0.8.23)
82
+ json (>= 1.8, < 3)
83
+ simplecov (~> 0.16.1)
84
+ term-ansicolor (~> 1.3)
85
+ thor (>= 0.19.4, < 2.0)
86
+ tins (~> 1.6)
87
+ crass (1.0.6)
88
+ digest (3.1.0)
89
+ docile (1.4.0)
90
+ erubi (1.11.0)
91
+ globalid (1.0.0)
92
+ activesupport (>= 5.0)
93
+ i18n (1.12.0)
94
+ concurrent-ruby (~> 1.0)
95
+ json (2.6.2)
96
+ loofah (2.18.0)
97
+ crass (~> 1.0.2)
98
+ nokogiri (>= 1.5.9)
99
+ mail (2.7.1)
100
+ mini_mime (>= 0.1.1)
101
+ marcel (1.0.2)
102
+ method_source (1.0.0)
103
+ mini_mime (1.1.2)
104
+ mini_portile2 (2.8.0)
105
+ minitest (5.16.2)
106
+ net-imap (0.2.3)
107
+ digest
108
+ net-protocol
109
+ strscan
110
+ net-pop (0.1.1)
111
+ digest
112
+ net-protocol
113
+ timeout
114
+ net-protocol (0.1.3)
115
+ timeout
116
+ net-smtp (0.3.1)
117
+ digest
118
+ net-protocol
119
+ timeout
120
+ nio4r (2.5.8)
121
+ nokogiri (1.13.8)
122
+ mini_portile2 (~> 2.8.0)
123
+ racc (~> 1.4)
124
+ racc (1.6.0)
125
+ rack (2.2.4)
126
+ rack-test (2.0.2)
127
+ rack (>= 1.3)
128
+ rails (7.0.3.1)
129
+ actioncable (= 7.0.3.1)
130
+ actionmailbox (= 7.0.3.1)
131
+ actionmailer (= 7.0.3.1)
132
+ actionpack (= 7.0.3.1)
133
+ actiontext (= 7.0.3.1)
134
+ actionview (= 7.0.3.1)
135
+ activejob (= 7.0.3.1)
136
+ activemodel (= 7.0.3.1)
137
+ activerecord (= 7.0.3.1)
138
+ activestorage (= 7.0.3.1)
139
+ activesupport (= 7.0.3.1)
140
+ bundler (>= 1.15.0)
141
+ railties (= 7.0.3.1)
142
+ rails-dom-testing (2.0.3)
143
+ activesupport (>= 4.2.0)
144
+ nokogiri (>= 1.6)
145
+ rails-html-sanitizer (1.4.3)
146
+ loofah (~> 2.3)
147
+ railties (7.0.3.1)
148
+ actionpack (= 7.0.3.1)
149
+ activesupport (= 7.0.3.1)
150
+ method_source
151
+ rake (>= 12.2)
152
+ thor (~> 1.0)
153
+ zeitwerk (~> 2.5)
154
+ rake (13.0.6)
155
+ simplecov (0.16.1)
156
+ docile (~> 1.1)
157
+ json (>= 1.8, < 3)
158
+ simplecov-html (~> 0.10.0)
159
+ simplecov-html (0.10.2)
160
+ sqlite3 (1.4.4)
161
+ strscan (3.0.4)
162
+ sync (0.5.0)
163
+ term-ansicolor (1.7.1)
164
+ tins (~> 1.0)
165
+ thor (1.2.1)
166
+ timeout (0.3.0)
167
+ tins (1.31.1)
168
+ sync
169
+ tzinfo (2.0.5)
170
+ concurrent-ruby (~> 1.0)
171
+ websocket-driver (0.7.5)
172
+ websocket-extensions (>= 0.1.0)
173
+ websocket-extensions (0.1.5)
174
+ zeitwerk (2.6.0)
175
+
176
+ PLATFORMS
177
+ ruby
178
+
179
+ DEPENDENCIES
180
+ active_model_exporters!
181
+ appraisal (~> 2.4)
182
+ bundler (~> 2.2)
183
+ coveralls (~> 0.8)
184
+ minitest (~> 5.14)
185
+ rails (~> 7.0.0)
186
+ rake (~> 13.0)
187
+ sqlite3 (~> 1.4)
188
+
189
+ BUNDLED WITH
190
+ 2.3.20
@@ -19,7 +19,7 @@ module ActiveModel
19
19
  private
20
20
 
21
21
  def generate_file(options = {})
22
- CSV.generate(options) do |file|
22
+ CSV.generate(**options) do |file|
23
23
  file << headers
24
24
  collection.each do |object|
25
25
  file << exporter_for(object).values
@@ -1,5 +1,5 @@
1
1
  module ActiveModel
2
2
  class Exporter
3
- VERSION = '0.5.1'
3
+ VERSION = '0.7.0'
4
4
  end
5
5
  end
@@ -9,12 +9,6 @@ module ActiveModel
9
9
 
10
10
  def attributes(*attrs)
11
11
  @_attributes.concat(attrs)
12
-
13
- attrs.each do |attr|
14
- define_method(attr) do
15
- object.send(attr)
16
- end unless method_defined?(attr)
17
- end
18
12
  end
19
13
 
20
14
  def exporter_for(resource)
@@ -32,7 +26,12 @@ module ActiveModel
32
26
 
33
27
  def values
34
28
  attrs = filter(attributes)
35
- attributes.map { |attr| send(attr) if attrs.include?(attr) }
29
+ attributes.map do |attr|
30
+ if attrs.include?(attr)
31
+ next send(attr) if respond_to?(attr)
32
+ object.send(attr)
33
+ end
34
+ end
36
35
  end
37
36
 
38
37
  def filter(attrs)
metadata CHANGED
@@ -1,29 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_exporters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Gutiérrez
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-22 00:00:00.000000000 Z
11
+ date: 2022-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activemodel
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: appraisal
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.8'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rails
15
99
  requirement: !ruby/object:Gem::Requirement
16
100
  requirements:
17
101
  - - ">="
18
102
  - !ruby/object:Gem::Version
19
- version: '4.0'
103
+ version: '6.0'
20
104
  type: :runtime
21
105
  prerelease: false
22
106
  version_requirements: !ruby/object:Gem::Requirement
23
107
  requirements:
24
108
  - - ">="
25
109
  - !ruby/object:Gem::Version
26
- version: '4.0'
110
+ version: '6.0'
27
111
  description: A simple way to export data in Rails.
28
112
  email:
29
113
  - alejandrodevs@gmail.com
@@ -35,17 +119,18 @@ files:
35
119
  - ".travis.yml"
36
120
  - Appraisals
37
121
  - CHANGELOG.md
122
+ - CODE_OF_CONDUCT.md
38
123
  - Gemfile
39
124
  - LICENSE.txt
40
125
  - README.md
41
126
  - Rakefile
42
127
  - active_model_exporters.gemspec
43
- - gemfiles/rails_4.gemfile
44
- - gemfiles/rails_4.gemfile.lock
45
- - gemfiles/rails_5.2.gemfile
46
- - gemfiles/rails_5.2.gemfile.lock
47
- - gemfiles/rails_5.gemfile
48
- - gemfiles/rails_5.gemfile.lock
128
+ - bin/console
129
+ - bin/setup
130
+ - gemfiles/rails_6.1.gemfile
131
+ - gemfiles/rails_6.1.gemfile.lock
132
+ - gemfiles/rails_7.0.gemfile
133
+ - gemfiles/rails_7.0.gemfile.lock
49
134
  - lib/action_controller/exportation.rb
50
135
  - lib/action_controller/exportation/mime_types.rb
51
136
  - lib/action_controller/exportation/renderers.rb
@@ -54,20 +139,14 @@ files:
54
139
  - lib/active_model/exporter/types.rb
55
140
  - lib/active_model/exporter/version.rb
56
141
  - lib/active_model_exporters.rb
57
- - test/fixtures/active_record/exporters.rb
58
- - test/fixtures/active_record/models.rb
59
- - test/fixtures/exporters.rb
60
- - test/fixtures/locale.rb
61
- - test/fixtures/models.rb
62
- - test/integration/action_controller/exportation/csv_test.rb
63
- - test/integration/action_controller/exportation/xls_test.rb
64
- - test/integration/active_record/exportation/csv_test.rb
65
- - test/test_helper.rb
66
142
  homepage: https://github.com/alejandrodevs/active_model_exporters
67
143
  licenses:
68
144
  - MIT
69
- metadata: {}
70
- post_install_message:
145
+ metadata:
146
+ homepage_uri: https://github.com/alejandrodevs/active_model_exporters
147
+ source_code_uri: https://github.com/alejandrodevs/active_model_exporters
148
+ changelog_uri: https://github.com/alejandrodevs/active_model_exporters/blob/master/LICENSE.txt
149
+ post_install_message:
71
150
  rdoc_options: []
72
151
  require_paths:
73
152
  - lib
@@ -75,25 +154,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
154
  requirements:
76
155
  - - ">="
77
156
  - !ruby/object:Gem::Version
78
- version: 2.0.0
157
+ version: '0'
79
158
  required_rubygems_version: !ruby/object:Gem::Requirement
80
159
  requirements:
81
160
  - - ">="
82
161
  - !ruby/object:Gem::Version
83
162
  version: '0'
84
163
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.7.3
87
- signing_key:
164
+ rubygems_version: 3.3.7
165
+ signing_key:
88
166
  specification_version: 4
89
167
  summary: A simple way to export data in Rails.
90
- test_files:
91
- - test/fixtures/active_record/exporters.rb
92
- - test/fixtures/active_record/models.rb
93
- - test/fixtures/exporters.rb
94
- - test/fixtures/locale.rb
95
- - test/fixtures/models.rb
96
- - test/integration/action_controller/exportation/csv_test.rb
97
- - test/integration/action_controller/exportation/xls_test.rb
98
- - test/integration/active_record/exportation/csv_test.rb
99
- - test/test_helper.rb
168
+ test_files: []
@@ -1,11 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3"
6
- gem "simplecov"
7
- gem "appraisal"
8
- gem "coveralls", require: false
9
- gem "rails", "~> 4.2"
10
-
11
- gemspec path: "../"
@@ -1,142 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- active_model_exporters (0.5.1)
5
- activemodel (>= 4.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actionmailer (4.2.10)
11
- actionpack (= 4.2.10)
12
- actionview (= 4.2.10)
13
- activejob (= 4.2.10)
14
- mail (~> 2.5, >= 2.5.4)
15
- rails-dom-testing (~> 1.0, >= 1.0.5)
16
- actionpack (4.2.10)
17
- actionview (= 4.2.10)
18
- activesupport (= 4.2.10)
19
- rack (~> 1.6)
20
- rack-test (~> 0.6.2)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
22
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- actionview (4.2.10)
24
- activesupport (= 4.2.10)
25
- builder (~> 3.1)
26
- erubis (~> 2.7.0)
27
- rails-dom-testing (~> 1.0, >= 1.0.5)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
29
- activejob (4.2.10)
30
- activesupport (= 4.2.10)
31
- globalid (>= 0.3.0)
32
- activemodel (4.2.10)
33
- activesupport (= 4.2.10)
34
- builder (~> 3.1)
35
- activerecord (4.2.10)
36
- activemodel (= 4.2.10)
37
- activesupport (= 4.2.10)
38
- arel (~> 6.0)
39
- activesupport (4.2.10)
40
- i18n (~> 0.7)
41
- minitest (~> 5.1)
42
- thread_safe (~> 0.3, >= 0.3.4)
43
- tzinfo (~> 1.1)
44
- appraisal (2.2.0)
45
- bundler
46
- rake
47
- thor (>= 0.14.0)
48
- arel (6.0.4)
49
- builder (3.2.3)
50
- concurrent-ruby (1.0.5)
51
- coveralls (0.7.2)
52
- multi_json (~> 1.3)
53
- rest-client (= 1.6.7)
54
- simplecov (>= 0.7)
55
- term-ansicolor (= 1.2.2)
56
- thor (= 0.18.1)
57
- crass (1.0.4)
58
- docile (1.3.0)
59
- erubis (2.7.0)
60
- globalid (0.4.1)
61
- activesupport (>= 4.2.0)
62
- i18n (0.9.5)
63
- concurrent-ruby (~> 1.0)
64
- json (2.1.0)
65
- loofah (2.2.2)
66
- crass (~> 1.0.2)
67
- nokogiri (>= 1.5.9)
68
- mail (2.7.0)
69
- mini_mime (>= 0.1.1)
70
- mime-types (3.1)
71
- mime-types-data (~> 3.2015)
72
- mime-types-data (3.2016.0521)
73
- mini_mime (1.0.0)
74
- mini_portile2 (2.3.0)
75
- minitest (5.11.3)
76
- multi_json (1.13.1)
77
- nokogiri (1.8.2)
78
- mini_portile2 (~> 2.3.0)
79
- rack (1.6.10)
80
- rack-test (0.6.3)
81
- rack (>= 1.0)
82
- rails (4.2.10)
83
- actionmailer (= 4.2.10)
84
- actionpack (= 4.2.10)
85
- actionview (= 4.2.10)
86
- activejob (= 4.2.10)
87
- activemodel (= 4.2.10)
88
- activerecord (= 4.2.10)
89
- activesupport (= 4.2.10)
90
- bundler (>= 1.3.0, < 2.0)
91
- railties (= 4.2.10)
92
- sprockets-rails
93
- rails-deprecated_sanitizer (1.0.3)
94
- activesupport (>= 4.2.0.alpha)
95
- rails-dom-testing (1.0.9)
96
- activesupport (>= 4.2.0, < 5.0)
97
- nokogiri (~> 1.6)
98
- rails-deprecated_sanitizer (>= 1.0.1)
99
- rails-html-sanitizer (1.0.4)
100
- loofah (~> 2.2, >= 2.2.2)
101
- railties (4.2.10)
102
- actionpack (= 4.2.10)
103
- activesupport (= 4.2.10)
104
- rake (>= 0.8.7)
105
- thor (>= 0.18.1, < 2.0)
106
- rake (12.3.1)
107
- rest-client (1.6.7)
108
- mime-types (>= 1.16)
109
- simplecov (0.16.1)
110
- docile (~> 1.1)
111
- json (>= 1.8, < 3)
112
- simplecov-html (~> 0.10.0)
113
- simplecov-html (0.10.2)
114
- sprockets (3.7.1)
115
- concurrent-ruby (~> 1.0)
116
- rack (> 1, < 3)
117
- sprockets-rails (3.2.1)
118
- actionpack (>= 4.0)
119
- activesupport (>= 4.0)
120
- sprockets (>= 3.0.0)
121
- sqlite3 (1.3.13)
122
- term-ansicolor (1.2.2)
123
- tins (~> 0.8)
124
- thor (0.18.1)
125
- thread_safe (0.3.6)
126
- tins (0.13.2)
127
- tzinfo (1.2.5)
128
- thread_safe (~> 0.1)
129
-
130
- PLATFORMS
131
- ruby
132
-
133
- DEPENDENCIES
134
- active_model_exporters!
135
- appraisal
136
- coveralls
137
- rails (~> 4.2)
138
- simplecov
139
- sqlite3
140
-
141
- BUNDLED WITH
142
- 1.16.2
@@ -1,11 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3"
6
- gem "simplecov"
7
- gem "appraisal"
8
- gem "coveralls", require: false
9
- gem "rails", "~> 5.2.0"
10
-
11
- gemspec path: "../"