active_model_exporters 0.5.2 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,212 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_model_exporters (0.7.1)
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
+ ast (2.4.2)
80
+ builder (3.2.4)
81
+ concurrent-ruby (1.1.10)
82
+ coveralls (0.8.23)
83
+ json (>= 1.8, < 3)
84
+ simplecov (~> 0.16.1)
85
+ term-ansicolor (~> 1.3)
86
+ thor (>= 0.19.4, < 2.0)
87
+ tins (~> 1.6)
88
+ crass (1.0.6)
89
+ digest (3.1.0)
90
+ docile (1.4.0)
91
+ erubi (1.11.0)
92
+ globalid (1.0.0)
93
+ activesupport (>= 5.0)
94
+ i18n (1.12.0)
95
+ concurrent-ruby (~> 1.0)
96
+ json (2.6.2)
97
+ loofah (2.18.0)
98
+ crass (~> 1.0.2)
99
+ nokogiri (>= 1.5.9)
100
+ mail (2.7.1)
101
+ mini_mime (>= 0.1.1)
102
+ marcel (1.0.2)
103
+ method_source (1.0.0)
104
+ mini_mime (1.1.2)
105
+ mini_portile2 (2.8.0)
106
+ minitest (5.16.2)
107
+ net-imap (0.2.3)
108
+ digest
109
+ net-protocol
110
+ strscan
111
+ net-pop (0.1.1)
112
+ digest
113
+ net-protocol
114
+ timeout
115
+ net-protocol (0.1.3)
116
+ timeout
117
+ net-smtp (0.3.1)
118
+ digest
119
+ net-protocol
120
+ timeout
121
+ nio4r (2.5.8)
122
+ nokogiri (1.13.8)
123
+ mini_portile2 (~> 2.8.0)
124
+ racc (~> 1.4)
125
+ parallel (1.22.1)
126
+ parser (3.1.2.1)
127
+ ast (~> 2.4.1)
128
+ racc (1.6.0)
129
+ rack (2.2.4)
130
+ rack-test (2.0.2)
131
+ rack (>= 1.3)
132
+ rails (7.0.3.1)
133
+ actioncable (= 7.0.3.1)
134
+ actionmailbox (= 7.0.3.1)
135
+ actionmailer (= 7.0.3.1)
136
+ actionpack (= 7.0.3.1)
137
+ actiontext (= 7.0.3.1)
138
+ actionview (= 7.0.3.1)
139
+ activejob (= 7.0.3.1)
140
+ activemodel (= 7.0.3.1)
141
+ activerecord (= 7.0.3.1)
142
+ activestorage (= 7.0.3.1)
143
+ activesupport (= 7.0.3.1)
144
+ bundler (>= 1.15.0)
145
+ railties (= 7.0.3.1)
146
+ rails-dom-testing (2.0.3)
147
+ activesupport (>= 4.2.0)
148
+ nokogiri (>= 1.6)
149
+ rails-html-sanitizer (1.4.3)
150
+ loofah (~> 2.3)
151
+ railties (7.0.3.1)
152
+ actionpack (= 7.0.3.1)
153
+ activesupport (= 7.0.3.1)
154
+ method_source
155
+ rake (>= 12.2)
156
+ thor (~> 1.0)
157
+ zeitwerk (~> 2.5)
158
+ rainbow (3.1.1)
159
+ rake (13.0.6)
160
+ regexp_parser (2.5.0)
161
+ rexml (3.2.5)
162
+ rubocop (1.35.0)
163
+ json (~> 2.3)
164
+ parallel (~> 1.10)
165
+ parser (>= 3.1.2.1)
166
+ rainbow (>= 2.2.2, < 4.0)
167
+ regexp_parser (>= 1.8, < 3.0)
168
+ rexml (>= 3.2.5, < 4.0)
169
+ rubocop-ast (>= 1.20.1, < 2.0)
170
+ ruby-progressbar (~> 1.7)
171
+ unicode-display_width (>= 1.4.0, < 3.0)
172
+ rubocop-ast (1.21.0)
173
+ parser (>= 3.1.1.0)
174
+ ruby-progressbar (1.11.0)
175
+ simplecov (0.16.1)
176
+ docile (~> 1.1)
177
+ json (>= 1.8, < 3)
178
+ simplecov-html (~> 0.10.0)
179
+ simplecov-html (0.10.2)
180
+ sqlite3 (1.4.4)
181
+ strscan (3.0.4)
182
+ sync (0.5.0)
183
+ term-ansicolor (1.7.1)
184
+ tins (~> 1.0)
185
+ thor (1.2.1)
186
+ timeout (0.3.0)
187
+ tins (1.31.1)
188
+ sync
189
+ tzinfo (2.0.5)
190
+ concurrent-ruby (~> 1.0)
191
+ unicode-display_width (2.2.0)
192
+ websocket-driver (0.7.5)
193
+ websocket-extensions (>= 0.1.0)
194
+ websocket-extensions (0.1.5)
195
+ zeitwerk (2.6.0)
196
+
197
+ PLATFORMS
198
+ ruby
199
+
200
+ DEPENDENCIES
201
+ active_model_exporters!
202
+ appraisal (~> 2.4)
203
+ bundler (~> 2.3)
204
+ coveralls (~> 0.8)
205
+ minitest (~> 5.16)
206
+ rails (~> 7.0.0)
207
+ rake (~> 13.0)
208
+ rubocop (~> 1.35)
209
+ sqlite3 (~> 1.4)
210
+
211
+ BUNDLED WITH
212
+ 2.3.20
@@ -1 +1,3 @@
1
- Mime::Type.register('application/vnd.ms-excel', :xls)
1
+ # frozen_string_literal: true
2
+
3
+ Mime::Type.register("application/vnd.ms-excel", :xls)
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveModel::Exporter::TYPES.each do |type|
2
4
  ActionController::Renderers.add type do |resource, options|
3
5
  method = "to_#{type}".to_sym
4
6
 
5
7
  if resource.respond_to?(method)
6
- encode = options[:encode] || 'iso-8859-1'
8
+ encode = options[:encode] || "iso-8859-1"
7
9
  mtype = Mime[type.to_sym]
8
10
  file = resource.send(method).encode(encode)
9
11
 
10
- default_options = {type: mtype, disposition: 'attachment'}
12
+ default_options = { type: mtype, disposition: "attachment" }
11
13
  send_data(file, default_options.merge(options))
12
14
  else
13
15
  resource
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionController
2
4
  module Exportation
3
5
  extend ActiveSupport::Concern
@@ -14,7 +16,7 @@ module ActionController
14
16
  end
15
17
 
16
18
  ActiveModel::Exporter::TYPES.each do |type|
17
- [:_render_option_, :_render_with_renderer_].each do |prefix|
19
+ %i[_render_option_ _render_with_renderer_].each do |prefix|
18
20
  define_method "#{prefix}#{type}" do |resource, options|
19
21
  exporter = build_exporter(resource, options)
20
22
  exporter ? super(exporter, options) : super
@@ -30,10 +32,9 @@ module ActionController
30
32
  end
31
33
 
32
34
  def build_exporter(resource, options)
33
- if exporter = ActiveModel::ArrayExporter
34
- options[:scope] ||= exportation_scope
35
- exporter.new(resource, options)
36
- end
35
+ return unless (exporter = ActiveModel::ArrayExporter)
36
+ options[:scope] ||= exportation_scope
37
+ exporter.new(resource, options)
37
38
  end
38
39
  end
39
40
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class ArrayExporter
3
5
  attr_reader :collection, :exporter, :scope
@@ -19,7 +21,7 @@ module ActiveModel
19
21
  private
20
22
 
21
23
  def generate_file(options = {})
22
- CSV.generate(options) do |file|
24
+ CSV.generate(**options) do |file|
23
25
  file << headers
24
26
  collection.each do |object|
25
27
  file << exporter_for(object).values
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Exporter
3
- TYPES = [:csv, :xls]
5
+ TYPES = %i[csv xls].freeze
4
6
  end
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Exporter
3
- VERSION = '0.5.2'
5
+ VERSION = "0.7.1"
4
6
  end
5
7
  end
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Exporter
3
5
  class << self
4
6
  attr_accessor :_attributes
5
7
 
6
8
  def inherited(base)
9
+ super
7
10
  base._attributes = (_attributes || []).dup
8
11
  end
9
12
 
@@ -16,7 +19,6 @@ module ActiveModel
16
19
  end
17
20
  end
18
21
 
19
-
20
22
  attr_reader :object, :scope
21
23
 
22
24
  def initialize(object, options = {})
@@ -1,14 +1,16 @@
1
- require 'csv'
2
- require 'active_model'
3
- require 'active_model/exporter'
4
- require 'active_model/exporter/types'
5
- require 'active_model/array_exporter'
6
- require 'active_model/exporter/version'
1
+ # frozen_string_literal: true
2
+
3
+ require "csv"
4
+ require "active_model"
5
+ require "active_model/exporter"
6
+ require "active_model/exporter/types"
7
+ require "active_model/array_exporter"
8
+ require "active_model/exporter/version"
7
9
 
8
10
  if defined?(ActionController)
9
- require 'action_controller/exportation'
10
- require 'action_controller/exportation/mime_types'
11
- require 'action_controller/exportation/renderers'
11
+ require "action_controller/exportation"
12
+ require "action_controller/exportation/mime_types"
13
+ require "action_controller/exportation/renderers"
12
14
 
13
15
  ActiveSupport.on_load(:action_controller) do
14
16
  include ::ActionController::Exportation
metadata CHANGED
@@ -1,113 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_exporters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Gutiérrez
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2022-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '12.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '12.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.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.0'
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.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '5.0'
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.2'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.2'
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
13
  - !ruby/object:Gem::Dependency
98
14
  name: rails
99
15
  requirement: !ruby/object:Gem::Requirement
100
16
  requirements:
101
17
  - - ">="
102
18
  - !ruby/object:Gem::Version
103
- version: '4.2'
19
+ version: '6.0'
104
20
  type: :runtime
105
21
  prerelease: false
106
22
  version_requirements: !ruby/object:Gem::Requirement
107
23
  requirements:
108
24
  - - ">="
109
25
  - !ruby/object:Gem::Version
110
- version: '4.2'
26
+ version: '6.0'
111
27
  description: A simple way to export data in Rails.
112
28
  email:
113
29
  - alejandrodevs@gmail.com
@@ -115,19 +31,19 @@ executables: []
115
31
  extensions: []
116
32
  extra_rdoc_files: []
117
33
  files:
118
- - ".gitignore"
119
- - ".travis.yml"
34
+ - ".rubocop.yml"
120
35
  - Appraisals
121
36
  - CHANGELOG.md
37
+ - CODE_OF_CONDUCT.md
122
38
  - Gemfile
123
39
  - LICENSE.txt
124
40
  - README.md
125
41
  - Rakefile
126
42
  - active_model_exporters.gemspec
127
- - gemfiles/rails_5.2.gemfile
128
- - gemfiles/rails_5.2.gemfile.lock
129
- - gemfiles/rails_6.0.gemfile
130
- - gemfiles/rails_6.0.gemfile.lock
43
+ - gemfiles/rails_6.1.gemfile
44
+ - gemfiles/rails_6.1.gemfile.lock
45
+ - gemfiles/rails_7.0.gemfile
46
+ - gemfiles/rails_7.0.gemfile.lock
131
47
  - lib/action_controller/exportation.rb
132
48
  - lib/action_controller/exportation/mime_types.rb
133
49
  - lib/action_controller/exportation/renderers.rb
@@ -142,8 +58,9 @@ licenses:
142
58
  metadata:
143
59
  homepage_uri: https://github.com/alejandrodevs/active_model_exporters
144
60
  source_code_uri: https://github.com/alejandrodevs/active_model_exporters
145
- changelog_uri: https://github.com/alejandrodevs/active_model_exporters/blob/master/LICENSE.txt
146
- post_install_message:
61
+ changelog_uri: https://github.com/alejandrodevs/active_model_exporters/blob/master/CHANGELOG.md
62
+ rubygems_mfa_required: 'true'
63
+ post_install_message:
147
64
  rdoc_options: []
148
65
  require_paths:
149
66
  - lib
@@ -151,15 +68,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
68
  requirements:
152
69
  - - ">="
153
70
  - !ruby/object:Gem::Version
154
- version: '0'
71
+ version: 2.7.0
155
72
  required_rubygems_version: !ruby/object:Gem::Requirement
156
73
  requirements:
157
74
  - - ">="
158
75
  - !ruby/object:Gem::Version
159
76
  version: '0'
160
77
  requirements: []
161
- rubygems_version: 3.0.3
162
- signing_key:
78
+ rubygems_version: 3.3.7
79
+ signing_key:
163
80
  specification_version: 4
164
81
  summary: A simple way to export data in Rails.
165
82
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- coverage
10
- .ruby-version
11
- Gemfile.lock
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- sudo: false
2
- cache: bundler
3
- language: ruby
4
-
5
- rvm:
6
- - 2.5.5
7
- - 2.6.3
8
-
9
- before_install:
10
- - gem install bundler -v 2.0.2
11
-
12
- gemfile:
13
- - gemfiles/rails_5.2.gemfile
14
- - gemfiles/rails_6.0.gemfile
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.2"
6
-
7
- gemspec path: "../"