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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4a48c0d4a079fdc539290365e3aea2957686fd18df6d41e27fd03e8ee61d7cc
4
- data.tar.gz: c52620894a6a89772b147b64d8b02040f6577c9f9a8c4ca75ce7c59f5c21c294
3
+ metadata.gz: 0d3e9b9e15d22e71ba4232a12054a38bd47c9c8c326c92b128ac9a3f267d3b5c
4
+ data.tar.gz: d6dc5946ff8fec7824850bd271538343068d6085a513254133774c6e04cd6126
5
5
  SHA512:
6
- metadata.gz: 3886a47851f83d5a540608b16e3f8b583bb0b0431c3be8ea961515f32668ea202f0a6717af2dd0ddd080ced36c5c62fcf83bc9f76c8454c35e5fb2cb0b0f7cd9
7
- data.tar.gz: dcec447c370025cddc21a1c7c2e48d9b53b7f7b2aab5b31b8a6318632524befeaebd25ee9c3c8d7c07e08a609a0b711799d0b52ab93577cab64656e708fca054
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
@@ -1,7 +1,9 @@
1
- appraise 'rails-6.1' do
2
- gem 'rails', '~> 6.1.0'
1
+ # frozen_string_literal: true
2
+
3
+ appraise "rails-6.1" do
4
+ gem "rails", "~> 6.1.0"
3
5
  end
4
6
 
5
- appraise 'rails-7.0' do
6
- gem 'rails', '~> 7.0.0'
7
+ appraise "rails-7.0" do
8
+ gem "rails", "~> 7.0.0"
7
9
  end
data/CHANGELOG.md CHANGED
@@ -1,69 +1,73 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 0.7.0
4
- * Add support for rails 7.0.
5
- * Add support for ruby 3.1.
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
- ### Version 0.6.0
10
- * Add support for rails 6.1.
11
- * Add support for ruby 3.0.
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
- ### Version 0.5.2
14
- * Add support for rails 6.0.
15
- * Minimum ruby version supported 2.6.X.
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
- ### Version 0.5.1
21
- * Add rails version supported 5.2.X.
22
- * Minimum ruby version supported 2.5.0.
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
- ### Version 0.5.0
25
- * Rails versions supported 4.X.X and 5.X.X.
26
- * Minimum ruby version supported 2.2.2.
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
- ### Version 0.4.1
29
- * Improvements: Moving dependecies to .gemspec
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
- ### Version 0.4.0
32
- * Ruby ~> 1.9.3 is not longer supported.
33
- * activemodel version dependency >= 4.0.
32
+ ## [0.4.1] - 2016-03-30
33
+ - Improvements: Moving dependecies to .gemspec
34
34
 
35
- ### Version 0.3.2
36
- * Adding support to export a single resource.
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
- ### Version 0.3.1
39
- * Fixing errors with rails 4.2.X.
39
+ ## [0.3.2] - 2015-11-02
40
+ - Adding support to export a single resource.
40
41
 
41
- ### Version 0.3.0
42
- * Adding support to rails 4.2.X.
42
+ ## [0.3.1] - 2015-06-08
43
+ - Fixing errors with rails 4.2.X.
43
44
 
44
- ### Version 0.2.0
45
- * Using I18n translations in file headers.
45
+ ## [0.3.0] - 2015-06-08
46
+ - Adding support to rails 4.2.X.
46
47
 
47
- ### Version 0.1.0
48
- * Including file headers
48
+ ## [0.2.0] - 2014-07-14
49
+ - Using I18n translations in file headers.
49
50
 
50
- ### Version 0.0.5
51
- * Using send_data method
52
- * Customizable filename
53
- * Customizable encode format
51
+ ## [0.1.0] - 2014-07-10
52
+ - Including file headers
54
53
 
55
- ### Version 0.0.4
56
- * Exporting to XLS format
54
+ ## [0.0.5] - 2014-07-02
55
+ - Using send_data method
56
+ - Customizable filename
57
+ - Customizable encode format
57
58
 
58
- ### Version 0.0.3
59
- * Adding filter method
59
+ ## [0.0.4] - 2014-07-01
60
+ - Exporting to XLS format
60
61
 
61
- ### Version 0.0.2
62
- * Default current_user scope
63
- * Explicit exportation scope
64
- * Scope calling exportation_scope
62
+ ## [0.0.3] - 2014-06-30
63
+ - Adding filter method
65
64
 
66
- ### Version 0.0.1
67
- * First version
68
- * Computed properties
69
- * Customizable exporter
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
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
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 creating a positive environment
15
- include:
11
+ Examples of behavior that contributes to a positive environment for our community include:
16
12
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
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 by participants include:
19
+ Examples of unacceptable behavior include:
24
20
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
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 electronic
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
- ## Our Responsibilities
30
+ ## Enforcement Responsibilities
35
31
 
36
- Project maintainers are responsible for clarifying the standards of acceptable
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
- Project maintainers have the right and responsibility to remove, edit, or
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 both within project spaces and in public spaces
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
- reported by contacting the project team at alejandrodevs@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
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
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
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 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
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
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
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
- source 'https://rubygems.org'
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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Alejandro Gutiérrez
3
+ Copyright (c) 2022 Alejandro Gutiérrez
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/Rakefile CHANGED
@@ -1,10 +1,16 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
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 << 'test'
6
- t.libs << 'lib'
7
- t.test_files = FileList['test/**/*_test.rb']
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
8
10
  end
9
11
 
10
- task default: :test
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -1,36 +1,40 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'active_model/exporter/version'
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 = 'active_model_exporters'
7
- spec.version = ActiveModel::Exporter::VERSION
8
- spec.authors = ['Alejandro Gutiérrez']
9
- spec.email = ['alejandrodevs@gmail.com']
10
- spec.summary = 'A simple way to export data in Rails.'
11
- spec.description = 'A simple way to export data in Rails.'
12
- spec.homepage = 'https://github.com/alejandrodevs/active_model_exporters'
13
- spec.license = 'MIT'
14
-
15
- spec.metadata['homepage_uri'] = spec.homepage
16
- spec.metadata['source_code_uri'] = spec.homepage
17
- spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/LICENSE.txt"
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 = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
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 = 'exe'
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ['lib']
27
-
28
- spec.add_development_dependency 'rake', '~> 13.0'
29
- spec.add_development_dependency 'bundler', '~> 2.2'
30
- spec.add_development_dependency 'sqlite3', '~> 1.4'
31
- spec.add_development_dependency 'minitest', '~> 5.14'
32
- spec.add_development_dependency 'appraisal', '~> 2.4'
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
@@ -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.0)
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.2)
187
+ bundler (~> 2.3)
167
188
  coveralls (~> 0.8)
168
- minitest (~> 5.14)
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
@@ -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.0)
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.2)
203
+ bundler (~> 2.3)
183
204
  coveralls (~> 0.8)
184
- minitest (~> 5.14)
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 +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
@@ -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.7.0'
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,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.0
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
- - ".gitignore"
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/LICENSE.txt
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: '0'
71
+ version: 2.7.0
158
72
  required_rubygems_version: !ruby/object:Gem::Requirement
159
73
  requirements:
160
74
  - - ">="
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
- cache: bundler
2
- language: ruby
3
-
4
- rvm:
5
- - 2.7.6
6
- - 3.0.0
7
- - 3.1.2
8
-
9
- before_install:
10
- - gem install bundler -v 2.3.20
11
-
12
- gemfile:
13
- - gemfiles/rails_6.1.gemfile
14
- - gemfiles/rails_7.0.gemfile
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__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here