csvbuilder-dynamic-columns-importer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.rspec +3 -0
- data/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +54 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +93 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +14 -0
- data/gemfiles/Gemfile.5.2._gemfile +19 -0
- data/gemfiles/Gemfile.6.1._gemfile +19 -0
- data/gemfiles/Gemfile.7.0._gemfile +19 -0
- data/lib/.DS_Store +0 -0
- data/lib/csvbuilder/.DS_Store +0 -0
- data/lib/csvbuilder/dynamic/.DS_Store +0 -0
- data/lib/csvbuilder/dynamic/columns/.DS_Store +0 -0
- data/lib/csvbuilder/dynamic/columns/importer/concerns/import/dynamic_columns.rb +57 -0
- data/lib/csvbuilder/dynamic/columns/importer/internal/dynamic_column_attribute_base.rb +44 -0
- data/lib/csvbuilder/dynamic/columns/importer/internal/import/dynamic_column_attribute.rb +36 -0
- data/lib/csvbuilder/dynamic/columns/importer/public/import.rb +6 -0
- data/lib/csvbuilder/dynamic/columns/importer/version.rb +11 -0
- data/lib/csvbuilder/dynamic/columns/importer.rb +11 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fae90eb58f14072abf9068c09b125a5b6d44948a246cb83cd90c6456848d876f
|
4
|
+
data.tar.gz: 93999aae3ddd011a8784df49be8bf05b184bf5c1bd3d24c54d6144b42e874d81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 11d103d4abc5a98e72436bbf498aed37c31229d9e8923ea3af9636e3fd4f3e4adaa9e874c291ac3e5065ed7ccc81fb0cf43f50c573458fd3b5b63e899cd92441
|
7
|
+
data.tar.gz: fcd52c72ed997f91515d785b79b5a14d65f9b23e7bca908e4c63a677ac51a95883954511de1229d53c0c01beb0f606f70a718efa6593689bc4265ead8aaeae58
|
data/.DS_Store
ADDED
Binary file
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
7
|
+
|
8
|
+
AllCops:
|
9
|
+
NewCops: enable
|
10
|
+
TargetRubyVersion: 2.6
|
11
|
+
|
12
|
+
Style/StringLiterals:
|
13
|
+
Enabled: true
|
14
|
+
EnforcedStyle: double_quotes
|
15
|
+
|
16
|
+
Style/StringLiteralsInInterpolation:
|
17
|
+
Enabled: true
|
18
|
+
EnforcedStyle: double_quotes
|
19
|
+
|
20
|
+
Layout/LineLength:
|
21
|
+
Max: 120
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2022-12-23 10:51:18 UTC using RuboCop version 1.41.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: CountComments, CountAsOne.
|
11
|
+
Metrics/ModuleLength:
|
12
|
+
Max: 104
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
16
|
+
# Prefixes: when, with, without
|
17
|
+
RSpec/ContextWording:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/csvbuilder/dynamic/columns/importer/concerns/import/dynamic_columns_spec.rb'
|
20
|
+
|
21
|
+
# Offense count: 4
|
22
|
+
# Configuration parameters: CountAsOne.
|
23
|
+
RSpec/ExampleLength:
|
24
|
+
Max: 10
|
25
|
+
|
26
|
+
# Offense count: 6
|
27
|
+
# Configuration parameters: .
|
28
|
+
# SupportedStyles: have_received, receive
|
29
|
+
RSpec/MessageSpies:
|
30
|
+
EnforcedStyle: receive
|
31
|
+
|
32
|
+
# Offense count: 4
|
33
|
+
RSpec/MultipleExpectations:
|
34
|
+
Max: 3
|
35
|
+
|
36
|
+
# Offense count: 1
|
37
|
+
RSpec/StubbedMock:
|
38
|
+
Exclude:
|
39
|
+
- 'spec/csvbuilder/dynamic/columns/importer/concerns/import/dynamic_columns_spec.rb'
|
40
|
+
|
41
|
+
# Offense count: 3
|
42
|
+
# Configuration parameters: AllowedConstants.
|
43
|
+
Style/Documentation:
|
44
|
+
Exclude:
|
45
|
+
- 'spec/**/*'
|
46
|
+
- 'test/**/*'
|
47
|
+
- 'lib/csvbuilder/dynamic/columns/importer/concerns/import/dynamic_columns.rb'
|
48
|
+
- 'lib/csvbuilder/dynamic/columns/importer/internal/dynamic_column_attribute_base.rb'
|
49
|
+
- 'lib/csvbuilder/dynamic/columns/importer/internal/import/dynamic_column_attribute.rb'
|
50
|
+
|
51
|
+
# Offense count: 1
|
52
|
+
Style/OpenStructUse:
|
53
|
+
Exclude:
|
54
|
+
- 'spec/support/fixtures/concerns/attributes.rb'
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
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.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
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
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
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
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
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.
|
33
|
+
|
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.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
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.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at joel.azemar@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.
|
59
|
+
|
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.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
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
|
82
|
+
|
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
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in csvbuilder-dynamic-columns.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake"
|
9
|
+
|
10
|
+
gem "rspec"
|
11
|
+
|
12
|
+
gem "rubocop"
|
13
|
+
|
14
|
+
gem "rubocop-performance"
|
15
|
+
gem "rubocop-rake"
|
16
|
+
gem "rubocop-rspec"
|
17
|
+
|
18
|
+
# gem "csvbuilder-dynamic-columns-core", path: "../csvbuilder-dynamic-columns-core"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
csvbuilder-dynamic-columns-importer (0.1.0)
|
5
|
+
activesupport (>= 5.2, < 8)
|
6
|
+
csvbuilder-core
|
7
|
+
csvbuilder-dynamic-columns-core
|
8
|
+
csvbuilder-importer
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activemodel (7.0.4)
|
14
|
+
activesupport (= 7.0.4)
|
15
|
+
activesupport (7.0.4)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
ast (2.4.2)
|
21
|
+
concurrent-ruby (1.1.10)
|
22
|
+
csvbuilder-core (0.1.2)
|
23
|
+
activesupport (>= 5.2, < 8)
|
24
|
+
csvbuilder-dynamic-columns-core (0.1.0)
|
25
|
+
activesupport (>= 5.2, < 8)
|
26
|
+
csvbuilder-core
|
27
|
+
csvbuilder-importer (0.1.3)
|
28
|
+
activemodel (>= 5.2, < 8)
|
29
|
+
activesupport (>= 5.2, < 8)
|
30
|
+
csvbuilder-core
|
31
|
+
diff-lcs (1.5.0)
|
32
|
+
i18n (1.12.0)
|
33
|
+
concurrent-ruby (~> 1.0)
|
34
|
+
json (2.6.3)
|
35
|
+
minitest (5.16.3)
|
36
|
+
parallel (1.22.1)
|
37
|
+
parser (3.1.3.0)
|
38
|
+
ast (~> 2.4.1)
|
39
|
+
rainbow (3.1.1)
|
40
|
+
rake (13.0.6)
|
41
|
+
regexp_parser (2.6.1)
|
42
|
+
rexml (3.2.5)
|
43
|
+
rspec (3.12.0)
|
44
|
+
rspec-core (~> 3.12.0)
|
45
|
+
rspec-expectations (~> 3.12.0)
|
46
|
+
rspec-mocks (~> 3.12.0)
|
47
|
+
rspec-core (3.12.0)
|
48
|
+
rspec-support (~> 3.12.0)
|
49
|
+
rspec-expectations (3.12.1)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.12.0)
|
52
|
+
rspec-mocks (3.12.1)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.12.0)
|
55
|
+
rspec-support (3.12.0)
|
56
|
+
rubocop (1.41.1)
|
57
|
+
json (~> 2.3)
|
58
|
+
parallel (~> 1.10)
|
59
|
+
parser (>= 3.1.2.1)
|
60
|
+
rainbow (>= 2.2.2, < 4.0)
|
61
|
+
regexp_parser (>= 1.8, < 3.0)
|
62
|
+
rexml (>= 3.2.5, < 4.0)
|
63
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
64
|
+
ruby-progressbar (~> 1.7)
|
65
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
66
|
+
rubocop-ast (1.24.0)
|
67
|
+
parser (>= 3.1.1.0)
|
68
|
+
rubocop-performance (1.15.1)
|
69
|
+
rubocop (>= 1.7.0, < 2.0)
|
70
|
+
rubocop-ast (>= 0.4.0)
|
71
|
+
rubocop-rake (0.6.0)
|
72
|
+
rubocop (~> 1.0)
|
73
|
+
rubocop-rspec (2.16.0)
|
74
|
+
rubocop (~> 1.33)
|
75
|
+
ruby-progressbar (1.11.0)
|
76
|
+
tzinfo (2.0.5)
|
77
|
+
concurrent-ruby (~> 1.0)
|
78
|
+
unicode-display_width (2.3.0)
|
79
|
+
|
80
|
+
PLATFORMS
|
81
|
+
arm64-darwin-21
|
82
|
+
|
83
|
+
DEPENDENCIES
|
84
|
+
csvbuilder-dynamic-columns-importer!
|
85
|
+
rake
|
86
|
+
rspec
|
87
|
+
rubocop
|
88
|
+
rubocop-performance
|
89
|
+
rubocop-rake
|
90
|
+
rubocop-rspec
|
91
|
+
|
92
|
+
BUNDLED WITH
|
93
|
+
2.3.22
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Joel Azemar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Csvbuilder::Dynamic::Columns
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/csvbuilder/dynamic/columns`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add csvbuilder-dynamic-columns
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install csvbuilder-dynamic-columns
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TODO: Write usage instructions here
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
+
|
25
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/csvbuilder-dynamic-columns. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/csvbuilder-dynamic-columns/blob/main/CODE_OF_CONDUCT.md).
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
34
|
+
|
35
|
+
## Code of Conduct
|
36
|
+
|
37
|
+
Everyone interacting in the Csvbuilder::Dynamic::Columns project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/csvbuilder-dynamic-columns/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
require "rubocop/rake_task"
|
9
|
+
|
10
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
11
|
+
task.options = ["-A"]
|
12
|
+
end
|
13
|
+
|
14
|
+
task default: %i[spec rubocop]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Runtime dependencies
|
6
|
+
gem "activesupport", "~> 5.2"
|
7
|
+
|
8
|
+
# Libraries dependencies
|
9
|
+
gem "csvbuilder-core"
|
10
|
+
gem "csvbuilder-dynamic-columns-core"
|
11
|
+
gem "csvbuilder-importer"
|
12
|
+
|
13
|
+
# Development dependencies
|
14
|
+
gem "rake"
|
15
|
+
gem "rspec"
|
16
|
+
gem "rubocop"
|
17
|
+
gem "rubocop-performance"
|
18
|
+
gem "rubocop-rake"
|
19
|
+
gem "rubocop-rspec"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Runtime dependencies
|
6
|
+
gem "activesupport", "~> 6.1"
|
7
|
+
|
8
|
+
# Libraries dependencies
|
9
|
+
gem "csvbuilder-core"
|
10
|
+
gem "csvbuilder-dynamic-columns-core"
|
11
|
+
gem "csvbuilder-importer"
|
12
|
+
|
13
|
+
# Development dependencies
|
14
|
+
gem "rake"
|
15
|
+
gem "rspec"
|
16
|
+
gem "rubocop"
|
17
|
+
gem "rubocop-performance"
|
18
|
+
gem "rubocop-rake"
|
19
|
+
gem "rubocop-rspec"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Runtime dependencies
|
6
|
+
gem "activemodel", "~> 7.0"
|
7
|
+
|
8
|
+
# Libraries dependencies
|
9
|
+
gem "csvbuilder-core"
|
10
|
+
gem "csvbuilder-dynamic-columns-core"
|
11
|
+
gem "csvbuilder-importer"
|
12
|
+
|
13
|
+
# Development dependencies
|
14
|
+
gem "rake"
|
15
|
+
gem "rspec"
|
16
|
+
gem "rubocop"
|
17
|
+
gem "rubocop-performance"
|
18
|
+
gem "rubocop-rake"
|
19
|
+
gem "rubocop-rspec"
|
data/lib/.DS_Store
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "csvbuilder/dynamic/columns/core/concerns/dynamic_columns_base"
|
4
|
+
require "csvbuilder/dynamic/columns/importer/internal/import/dynamic_column_attribute"
|
5
|
+
|
6
|
+
module Csvbuilder
|
7
|
+
module Import
|
8
|
+
module DynamicColumns
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
include DynamicColumnsBase
|
11
|
+
|
12
|
+
included do
|
13
|
+
ensure_define_dynamic_attribute_method
|
14
|
+
end
|
15
|
+
|
16
|
+
def dynamic_column_attribute_objects
|
17
|
+
@dynamic_column_attribute_objects ||= array_to_block_hash(self.class.dynamic_column_names) do |column_name|
|
18
|
+
self.class.dynamic_attribute_class.new(
|
19
|
+
column_name,
|
20
|
+
dynamic_column_source_headers,
|
21
|
+
dynamic_column_source_cells,
|
22
|
+
self
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Array] an array of format_dynamic_column_header(...)
|
28
|
+
def formatted_dynamic_column_headers
|
29
|
+
dynamic_column_attribute_objects.values.first.try(:formatted_headers) || []
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Array] dynamic_column headers
|
33
|
+
def dynamic_column_source_headers
|
34
|
+
self.class.dynamic_column_source_headers source_headers
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [Array] dynamic_column row data
|
38
|
+
def dynamic_column_source_cells
|
39
|
+
self.class.dynamic_column_source_cells source_row
|
40
|
+
end
|
41
|
+
|
42
|
+
class_methods do
|
43
|
+
def dynamic_column_source_headers(source_headers)
|
44
|
+
dynamic_columns? ? source_headers[columns.size..] : []
|
45
|
+
end
|
46
|
+
|
47
|
+
def dynamic_column_source_cells(source_row)
|
48
|
+
dynamic_columns? ? source_row[columns.size..] : []
|
49
|
+
end
|
50
|
+
|
51
|
+
def dynamic_attribute_class
|
52
|
+
DynamicColumnAttribute
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "csvbuilder/core/internal/attribute_base"
|
4
|
+
require "csvbuilder/dynamic/columns/core/internal/concerns/dynamic_column_shared"
|
5
|
+
|
6
|
+
module Csvbuilder
|
7
|
+
class DynamicColumnAttributeBase < AttributeBase
|
8
|
+
include DynamicColumnShared
|
9
|
+
|
10
|
+
def value
|
11
|
+
@value ||= row_model_class.format_dynamic_column_cells(unformatted_value, column_name, row_model.context)
|
12
|
+
end
|
13
|
+
|
14
|
+
def formatted_cells
|
15
|
+
source_cells.map do |cell|
|
16
|
+
row_model_class.format_cell(cell, column_name, row_model.context)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def process_cell_method_name
|
23
|
+
self.class.process_cell_method_name(column_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Calls the process_cell to return the value of a Attribute given the args
|
27
|
+
def call_process_cell(*args)
|
28
|
+
row_model.public_send(process_cell_method_name, *args)
|
29
|
+
end
|
30
|
+
|
31
|
+
class << self
|
32
|
+
def process_cell_method_name(column_name)
|
33
|
+
column_name.to_s.singularize.to_sym
|
34
|
+
end
|
35
|
+
|
36
|
+
# define a method to process each cell of the attribute method
|
37
|
+
# process_cell = one cell
|
38
|
+
# attribute_method = many cells = [process_cell(), process_cell()...]
|
39
|
+
def define_process_cell(row_model_class, column_name, &block)
|
40
|
+
row_model_class.define_proxy_method(process_cell_method_name(column_name), &block)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "csvbuilder/dynamic/columns/core/internal/dynamic_column_attribute_base"
|
4
|
+
|
5
|
+
module Csvbuilder
|
6
|
+
module Import
|
7
|
+
class DynamicColumnAttribute < Csvbuilder::DynamicColumnAttributeBase
|
8
|
+
attr_reader :source_headers, :source_cells
|
9
|
+
|
10
|
+
def initialize(column_name, source_headers, source_cells, row_model)
|
11
|
+
@source_headers = source_headers
|
12
|
+
@source_cells = source_cells
|
13
|
+
|
14
|
+
super(column_name, row_model)
|
15
|
+
end
|
16
|
+
|
17
|
+
def unformatted_value
|
18
|
+
formatted_cells.zip(formatted_headers).map do |formatted_cell, source_headers|
|
19
|
+
call_process_cell(formatted_cell, source_headers)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def formatted_headers
|
24
|
+
source_headers.map do |source_headers|
|
25
|
+
row_model_class.format_dynamic_column_header(source_headers, column_name, row_model.context)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class << self
|
30
|
+
def define_process_cell(row_model_class, column_name)
|
31
|
+
super { |formatted_cell, _source_headers| formatted_cell }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "csvbuilder/dynamic/columns/importer/version"
|
4
|
+
|
5
|
+
require "csvbuilder/core"
|
6
|
+
require "csvbuilder/importer"
|
7
|
+
require "csvbuilder/dynamic/columns/core"
|
8
|
+
|
9
|
+
require "csvbuilder/dynamic/columns/core/public/model"
|
10
|
+
|
11
|
+
require "csvbuilder/dynamic/columns/importer/public/import"
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: csvbuilder-dynamic-columns-importer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joel Azemar
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-12-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '8'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: csvbuilder-core
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: csvbuilder-dynamic-columns-core
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: csvbuilder-importer
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
description: Help handle CSVs in a more efficient way
|
76
|
+
email:
|
77
|
+
- joel.azemar@gmail.com
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- ".DS_Store"
|
83
|
+
- ".rspec"
|
84
|
+
- ".rubocop.yml"
|
85
|
+
- ".rubocop_todo.yml"
|
86
|
+
- CHANGELOG.md
|
87
|
+
- CODE_OF_CONDUCT.md
|
88
|
+
- Gemfile
|
89
|
+
- Gemfile.lock
|
90
|
+
- LICENSE.txt
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- gemfiles/Gemfile.5.2._gemfile
|
94
|
+
- gemfiles/Gemfile.6.1._gemfile
|
95
|
+
- gemfiles/Gemfile.7.0._gemfile
|
96
|
+
- lib/.DS_Store
|
97
|
+
- lib/csvbuilder/.DS_Store
|
98
|
+
- lib/csvbuilder/dynamic/.DS_Store
|
99
|
+
- lib/csvbuilder/dynamic/columns/.DS_Store
|
100
|
+
- lib/csvbuilder/dynamic/columns/importer.rb
|
101
|
+
- lib/csvbuilder/dynamic/columns/importer/concerns/import/dynamic_columns.rb
|
102
|
+
- lib/csvbuilder/dynamic/columns/importer/internal/dynamic_column_attribute_base.rb
|
103
|
+
- lib/csvbuilder/dynamic/columns/importer/internal/import/dynamic_column_attribute.rb
|
104
|
+
- lib/csvbuilder/dynamic/columns/importer/public/import.rb
|
105
|
+
- lib/csvbuilder/dynamic/columns/importer/version.rb
|
106
|
+
homepage: https://github.com/joel/csvbuilder-dynamic-columns-importer
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata:
|
110
|
+
homepage_uri: https://github.com/joel/csvbuilder-dynamic-columns-importer
|
111
|
+
source_code_uri: https://github.com/joel/csvbuilder-dynamic-columns-importer
|
112
|
+
changelog_uri: https://github.com/joel/csvbuilder-dynamic-columns-importer/blob/main/CHANGELOG.md
|
113
|
+
rubygems_mfa_required: 'true'
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 2.6.0
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubygems_version: 3.3.22
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: Csvbuilder Dynamic Columns contain the components to handle CSV dynamic columns
|
133
|
+
test_files: []
|