active_model_exporters 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +22 -0
- data/Appraisals +6 -4
- data/CHANGELOG.md +55 -51
- data/CODE_OF_CONDUCT.md +57 -47
- data/Gemfile +13 -1
- data/LICENSE.txt +1 -1
- data/Rakefile +12 -6
- data/active_model_exporters.gemspec +33 -29
- data/gemfiles/rails_6.1.gemfile +7 -0
- data/gemfiles/rails_6.1.gemfile.lock +25 -3
- data/gemfiles/rails_7.0.gemfile +7 -0
- data/gemfiles/rails_7.0.gemfile.lock +25 -3
- data/lib/action_controller/exportation/mime_types.rb +3 -1
- data/lib/action_controller/exportation/renderers.rb +4 -2
- data/lib/action_controller/exportation.rb +6 -5
- data/lib/active_model/array_exporter.rb +2 -0
- data/lib/active_model/exporter/types.rb +3 -1
- data/lib/active_model/exporter/version.rb +3 -1
- data/lib/active_model/exporter.rb +3 -1
- data/lib/active_model_exporters.rb +11 -9
- metadata +5 -91
- data/.gitignore +0 -11
- data/.travis.yml +0 -14
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d3e9b9e15d22e71ba4232a12054a38bd47c9c8c326c92b128ac9a3f267d3b5c
|
4
|
+
data.tar.gz: d6dc5946ff8fec7824850bd271538343068d6085a513254133774c6e04cd6126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6154faa867ab3c0fe2dd0fe8c66b3443264655e53b2127292364123b457ca28a55529fd9ad2f4e349a3cbe91204babe04f972c4c036a56c5bc497f536e87eaf8
|
7
|
+
data.tar.gz: 572655f2acb4f06016b520daf95489609539f2d2b6d1b6a961bf027631fd287964a32785eb668b75d20f9099a2812a955cb2cb2daf948a8e9e90bc81b969e010
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
TargetRubyVersion: 2.7
|
4
|
+
Exclude:
|
5
|
+
- "gemfiles/**/*"
|
6
|
+
|
7
|
+
Style/StringLiterals:
|
8
|
+
Enabled: true
|
9
|
+
EnforcedStyle: double_quotes
|
10
|
+
|
11
|
+
Style/StringLiteralsInInterpolation:
|
12
|
+
Enabled: true
|
13
|
+
EnforcedStyle: double_quotes
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
17
|
+
|
18
|
+
Style/Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Layout/EmptyLineAfterGuardClause:
|
22
|
+
Enabled: false
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,69 +1,73 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* Stop supporting rails 5.2.
|
7
|
-
* Stop supporting ruby 2.6.
|
3
|
+
## [0.7.1] - 2022-08-15
|
4
|
+
- Update gem skeleton.
|
5
|
+
- Fix rubocop warnings.
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
## [0.7.0] - 2022-08-15
|
8
|
+
- Add support for rails 7.0.
|
9
|
+
- Add support for ruby 3.1.
|
10
|
+
- Stop supporting rails 5.2.
|
11
|
+
- Stop supporting ruby 2.6.
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
* Remove support for ruby 2.4.X.
|
17
|
-
* Avoid defining new methods in exporter.
|
18
|
-
* Update code base to use bundler 2.X.X.
|
13
|
+
## [0.6.0] - 2021-04-06
|
14
|
+
- Add support for rails 6.1.
|
15
|
+
- Add support for ruby 3.0.
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
## [0.5.2] - 2019-08-20
|
18
|
+
- Add support for rails 6.0.
|
19
|
+
- Minimum ruby version supported 2.6.X.
|
20
|
+
- Remove support for ruby 2.4.X.
|
21
|
+
- Avoid defining new methods in exporter.
|
22
|
+
- Update code base to use bundler 2.X.X.
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
## [0.5.1] - 2018-05-22
|
25
|
+
- Add rails version supported 5.2.X.
|
26
|
+
- Minimum ruby version supported 2.5.0.
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
## [0.5.0] - 2016-11-11
|
29
|
+
- Rails versions supported 4.X.X and 5.X.X.
|
30
|
+
- Minimum ruby version supported 2.2.2.
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
* activemodel version dependency >= 4.0.
|
32
|
+
## [0.4.1] - 2016-03-30
|
33
|
+
- Improvements: Moving dependecies to .gemspec
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
## [0.4.0] - 2016-03-28
|
36
|
+
- Ruby ~> 1.9.3 is not longer supported.
|
37
|
+
- activemodel version dependency >= 4.0.
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
## [0.3.2] - 2015-11-02
|
40
|
+
- Adding support to export a single resource.
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
## [0.3.1] - 2015-06-08
|
43
|
+
- Fixing errors with rails 4.2.X.
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
## [0.3.0] - 2015-06-08
|
46
|
+
- Adding support to rails 4.2.X.
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
## [0.2.0] - 2014-07-14
|
49
|
+
- Using I18n translations in file headers.
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
* Customizable filename
|
53
|
-
* Customizable encode format
|
51
|
+
## [0.1.0] - 2014-07-10
|
52
|
+
- Including file headers
|
54
53
|
|
55
|
-
|
56
|
-
|
54
|
+
## [0.0.5] - 2014-07-02
|
55
|
+
- Using send_data method
|
56
|
+
- Customizable filename
|
57
|
+
- Customizable encode format
|
57
58
|
|
58
|
-
|
59
|
-
|
59
|
+
## [0.0.4] - 2014-07-01
|
60
|
+
- Exporting to XLS format
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
* Explicit exportation scope
|
64
|
-
* Scope calling exportation_scope
|
62
|
+
## [0.0.3] - 2014-06-30
|
63
|
+
- Adding filter method
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
## [0.0.2] - 2014-06-27
|
66
|
+
- Default current_user scope
|
67
|
+
- Explicit exportation scope
|
68
|
+
- Scope calling exportation_scope
|
69
|
+
|
70
|
+
## [0.0.1] - 2014-06-27
|
71
|
+
- First version
|
72
|
+
- Computed properties
|
73
|
+
- Customizable exporter
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -2,73 +2,83 @@
|
|
2
2
|
|
3
3
|
## Our Pledge
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
11
8
|
|
12
9
|
## Our Standards
|
13
10
|
|
14
|
-
Examples of behavior that contributes to
|
15
|
-
include:
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
16
12
|
|
17
|
-
*
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
22
18
|
|
23
|
-
Examples of unacceptable behavior
|
19
|
+
Examples of unacceptable behavior include:
|
24
20
|
|
25
|
-
* The use of sexualized language or imagery and
|
26
|
-
advances
|
27
|
-
* Trolling, insulting
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
28
24
|
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or
|
30
|
-
address, without explicit permission
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
31
27
|
* Other conduct which could reasonably be considered inappropriate in a
|
32
28
|
professional setting
|
33
29
|
|
34
|
-
##
|
30
|
+
## Enforcement Responsibilities
|
35
31
|
|
36
|
-
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
39
33
|
|
40
|
-
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
45
35
|
|
46
36
|
## Scope
|
47
37
|
|
48
|
-
This Code of Conduct applies
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
54
39
|
|
55
40
|
## Enforcement
|
56
41
|
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at alejandrodevs@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
63
59
|
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
67
73
|
|
68
74
|
## Attribution
|
69
75
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version
|
71
|
-
available at
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
72
82
|
|
73
|
-
|
74
|
-
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
CHANGED
@@ -1,2 +1,14 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in gemtest.gemspec
|
2
6
|
gemspec
|
7
|
+
|
8
|
+
gem "appraisal", "~> 2.4"
|
9
|
+
gem "bundler", "~> 2.3"
|
10
|
+
gem "coveralls", "~> 0.8"
|
11
|
+
gem "minitest", "~> 5.16"
|
12
|
+
gem "rake", "~> 13.0"
|
13
|
+
gem "rubocop", "~> 1.35"
|
14
|
+
gem "sqlite3", "~> 1.4"
|
data/LICENSE.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
3
5
|
|
4
6
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
7
|
-
t.test_files = FileList[
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
8
10
|
end
|
9
11
|
|
10
|
-
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
@@ -1,36 +1,40 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/active_model/exporter/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
10
|
-
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.
|
14
|
-
|
15
|
-
spec.
|
16
|
-
|
17
|
-
spec.metadata[
|
6
|
+
spec.name = "active_model_exporters"
|
7
|
+
spec.version = ActiveModel::Exporter::VERSION
|
8
|
+
spec.authors = ["Alejandro Gutiérrez"]
|
9
|
+
spec.email = ["alejandrodevs@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "A simple way to export data in Rails."
|
12
|
+
spec.description = "A simple way to export data in Rails."
|
13
|
+
spec.homepage = "https://github.com/alejandrodevs/active_model_exporters"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.7.0"
|
16
|
+
|
17
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server "https://example.com""
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
22
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
18
23
|
|
19
24
|
# Specify which files should be added to the gem when it is released.
|
20
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
-
spec.files
|
22
|
-
`git ls-files -z`.split("\x0").reject
|
26
|
+
spec.files = Dir.chdir(__dir__) do
|
27
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
29
|
+
end
|
23
30
|
end
|
24
|
-
spec.bindir
|
25
|
-
spec.executables
|
26
|
-
spec.require_paths = [
|
27
|
-
|
28
|
-
|
29
|
-
spec.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
spec.add_development_dependency 'coveralls', '~> 0.8'
|
34
|
-
|
35
|
-
spec.add_dependency 'rails', '>= 6.0'
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
# Uncomment to register a new dependency of your gem
|
36
|
+
spec.add_dependency "rails", ">= 6.0"
|
37
|
+
|
38
|
+
# For more information and examples about making a new gem, check out our
|
39
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
36
40
|
end
|
data/gemfiles/rails_6.1.gemfile
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
+
gem "appraisal", "~> 2.4"
|
6
|
+
gem "bundler", "~> 2.3"
|
7
|
+
gem "coveralls", "~> 0.8"
|
8
|
+
gem "minitest", "~> 5.16"
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "rubocop", "~> 1.35"
|
11
|
+
gem "sqlite3", "~> 1.4"
|
5
12
|
gem "rails", "~> 6.1.0"
|
6
13
|
|
7
14
|
gemspec path: "../"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_model_exporters (0.7.
|
4
|
+
active_model_exporters (0.7.1)
|
5
5
|
rails (>= 6.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -70,6 +70,7 @@ GEM
|
|
70
70
|
bundler
|
71
71
|
rake
|
72
72
|
thor (>= 0.14.0)
|
73
|
+
ast (2.4.2)
|
73
74
|
builder (3.2.4)
|
74
75
|
concurrent-ruby (1.1.10)
|
75
76
|
coveralls (0.8.23)
|
@@ -100,6 +101,9 @@ GEM
|
|
100
101
|
nokogiri (1.13.8)
|
101
102
|
mini_portile2 (~> 2.8.0)
|
102
103
|
racc (~> 1.4)
|
104
|
+
parallel (1.22.1)
|
105
|
+
parser (3.1.2.1)
|
106
|
+
ast (~> 2.4.1)
|
103
107
|
racc (1.6.0)
|
104
108
|
rack (2.2.4)
|
105
109
|
rack-test (2.0.2)
|
@@ -130,7 +134,23 @@ GEM
|
|
130
134
|
method_source
|
131
135
|
rake (>= 0.8.7)
|
132
136
|
thor (~> 1.0)
|
137
|
+
rainbow (3.1.1)
|
133
138
|
rake (13.0.6)
|
139
|
+
regexp_parser (2.5.0)
|
140
|
+
rexml (3.2.5)
|
141
|
+
rubocop (1.35.0)
|
142
|
+
json (~> 2.3)
|
143
|
+
parallel (~> 1.10)
|
144
|
+
parser (>= 3.1.2.1)
|
145
|
+
rainbow (>= 2.2.2, < 4.0)
|
146
|
+
regexp_parser (>= 1.8, < 3.0)
|
147
|
+
rexml (>= 3.2.5, < 4.0)
|
148
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
149
|
+
ruby-progressbar (~> 1.7)
|
150
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
151
|
+
rubocop-ast (1.21.0)
|
152
|
+
parser (>= 3.1.1.0)
|
153
|
+
ruby-progressbar (1.11.0)
|
134
154
|
simplecov (0.16.1)
|
135
155
|
docile (~> 1.1)
|
136
156
|
json (>= 1.8, < 3)
|
@@ -152,6 +172,7 @@ GEM
|
|
152
172
|
sync
|
153
173
|
tzinfo (2.0.5)
|
154
174
|
concurrent-ruby (~> 1.0)
|
175
|
+
unicode-display_width (2.2.0)
|
155
176
|
websocket-driver (0.7.5)
|
156
177
|
websocket-extensions (>= 0.1.0)
|
157
178
|
websocket-extensions (0.1.5)
|
@@ -163,11 +184,12 @@ PLATFORMS
|
|
163
184
|
DEPENDENCIES
|
164
185
|
active_model_exporters!
|
165
186
|
appraisal (~> 2.4)
|
166
|
-
bundler (~> 2.
|
187
|
+
bundler (~> 2.3)
|
167
188
|
coveralls (~> 0.8)
|
168
|
-
minitest (~> 5.
|
189
|
+
minitest (~> 5.16)
|
169
190
|
rails (~> 6.1.0)
|
170
191
|
rake (~> 13.0)
|
192
|
+
rubocop (~> 1.35)
|
171
193
|
sqlite3 (~> 1.4)
|
172
194
|
|
173
195
|
BUNDLED WITH
|
data/gemfiles/rails_7.0.gemfile
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
+
gem "appraisal", "~> 2.4"
|
6
|
+
gem "bundler", "~> 2.3"
|
7
|
+
gem "coveralls", "~> 0.8"
|
8
|
+
gem "minitest", "~> 5.16"
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "rubocop", "~> 1.35"
|
11
|
+
gem "sqlite3", "~> 1.4"
|
5
12
|
gem "rails", "~> 7.0.0"
|
6
13
|
|
7
14
|
gemspec path: "../"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_model_exporters (0.7.
|
4
|
+
active_model_exporters (0.7.1)
|
5
5
|
rails (>= 6.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -76,6 +76,7 @@ GEM
|
|
76
76
|
bundler
|
77
77
|
rake
|
78
78
|
thor (>= 0.14.0)
|
79
|
+
ast (2.4.2)
|
79
80
|
builder (3.2.4)
|
80
81
|
concurrent-ruby (1.1.10)
|
81
82
|
coveralls (0.8.23)
|
@@ -121,6 +122,9 @@ GEM
|
|
121
122
|
nokogiri (1.13.8)
|
122
123
|
mini_portile2 (~> 2.8.0)
|
123
124
|
racc (~> 1.4)
|
125
|
+
parallel (1.22.1)
|
126
|
+
parser (3.1.2.1)
|
127
|
+
ast (~> 2.4.1)
|
124
128
|
racc (1.6.0)
|
125
129
|
rack (2.2.4)
|
126
130
|
rack-test (2.0.2)
|
@@ -151,7 +155,23 @@ GEM
|
|
151
155
|
rake (>= 12.2)
|
152
156
|
thor (~> 1.0)
|
153
157
|
zeitwerk (~> 2.5)
|
158
|
+
rainbow (3.1.1)
|
154
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)
|
155
175
|
simplecov (0.16.1)
|
156
176
|
docile (~> 1.1)
|
157
177
|
json (>= 1.8, < 3)
|
@@ -168,6 +188,7 @@ GEM
|
|
168
188
|
sync
|
169
189
|
tzinfo (2.0.5)
|
170
190
|
concurrent-ruby (~> 1.0)
|
191
|
+
unicode-display_width (2.2.0)
|
171
192
|
websocket-driver (0.7.5)
|
172
193
|
websocket-extensions (>= 0.1.0)
|
173
194
|
websocket-extensions (0.1.5)
|
@@ -179,11 +200,12 @@ PLATFORMS
|
|
179
200
|
DEPENDENCIES
|
180
201
|
active_model_exporters!
|
181
202
|
appraisal (~> 2.4)
|
182
|
-
bundler (~> 2.
|
203
|
+
bundler (~> 2.3)
|
183
204
|
coveralls (~> 0.8)
|
184
|
-
minitest (~> 5.
|
205
|
+
minitest (~> 5.16)
|
185
206
|
rails (~> 7.0.0)
|
186
207
|
rake (~> 13.0)
|
208
|
+
rubocop (~> 1.35)
|
187
209
|
sqlite3 (~> 1.4)
|
188
210
|
|
189
211
|
BUNDLED WITH
|
@@ -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] ||
|
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:
|
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
|
-
[
|
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
|
-
|
34
|
-
|
35
|
-
|
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,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
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
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
|
10
|
-
require
|
11
|
-
require
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_model_exporters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Gutiérrez
|
@@ -10,90 +10,6 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
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: '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
13
|
- !ruby/object:Gem::Dependency
|
98
14
|
name: rails
|
99
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,8 +31,7 @@ executables: []
|
|
115
31
|
extensions: []
|
116
32
|
extra_rdoc_files: []
|
117
33
|
files:
|
118
|
-
- ".
|
119
|
-
- ".travis.yml"
|
34
|
+
- ".rubocop.yml"
|
120
35
|
- Appraisals
|
121
36
|
- CHANGELOG.md
|
122
37
|
- CODE_OF_CONDUCT.md
|
@@ -125,8 +40,6 @@ files:
|
|
125
40
|
- README.md
|
126
41
|
- Rakefile
|
127
42
|
- active_model_exporters.gemspec
|
128
|
-
- bin/console
|
129
|
-
- bin/setup
|
130
43
|
- gemfiles/rails_6.1.gemfile
|
131
44
|
- gemfiles/rails_6.1.gemfile.lock
|
132
45
|
- gemfiles/rails_7.0.gemfile
|
@@ -145,7 +58,8 @@ licenses:
|
|
145
58
|
metadata:
|
146
59
|
homepage_uri: https://github.com/alejandrodevs/active_model_exporters
|
147
60
|
source_code_uri: https://github.com/alejandrodevs/active_model_exporters
|
148
|
-
changelog_uri: https://github.com/alejandrodevs/active_model_exporters/blob/master/
|
61
|
+
changelog_uri: https://github.com/alejandrodevs/active_model_exporters/blob/master/CHANGELOG.md
|
62
|
+
rubygems_mfa_required: 'true'
|
149
63
|
post_install_message:
|
150
64
|
rdoc_options: []
|
151
65
|
require_paths:
|
@@ -154,7 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
68
|
requirements:
|
155
69
|
- - ">="
|
156
70
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
71
|
+
version: 2.7.0
|
158
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
73
|
requirements:
|
160
74
|
- - ">="
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "active_model_exporters"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|