csvbuilder-dynamic-columns-exporter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9d6adf64db2e5a0d9c8dc5fb555489ff195bd00c3cebba5736a0ea6fcfb37b11
4
+ data.tar.gz: f084c0dc4f1b0df1547e47d7ff285ab7ab597e6f4838d0a926645e09a9a8da61
5
+ SHA512:
6
+ metadata.gz: 32a3f92953ef63f35d3b30f88d64c72dfba217077e6fb5ffd51ef9d32695098aeb42925acb0fa7e3bbd8336d4691b15d10113a751a8a213d1aa948a8c9823806
7
+ data.tar.gz: 2349dcb6730b77a227f3e6340ffb7b2e753bb2f7d880d8f4fb2b3ad678d69bf1e402c0b059f56e805d3ddc353b38a88430b5c76a0c912404b8507c5b68694970
data/.DS_Store ADDED
Binary file
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
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,44 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-12-23 11:40:53 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: Prefixes, AllowedPatterns.
11
+ # Prefixes: when, with, without
12
+ RSpec/ContextWording:
13
+ Exclude:
14
+ - 'spec/csvbuilder/dynamic/columns/exporter/concerns/export/dynamic_columns_spec.rb'
15
+
16
+ # Offense count: 3
17
+ # Configuration parameters: .
18
+ # SupportedStyles: have_received, receive
19
+ RSpec/MessageSpies:
20
+ EnforcedStyle: receive
21
+
22
+ # Offense count: 2
23
+ RSpec/MultipleExpectations:
24
+ Max: 2
25
+
26
+ # Offense count: 2
27
+ RSpec/RepeatedDescription:
28
+ Exclude:
29
+ - 'spec/csvbuilder/dynamic/columns/exporter/concerns/export/dynamic_columns_spec.rb'
30
+
31
+ # Offense count: 2
32
+ # Configuration parameters: AllowedConstants.
33
+ Style/Documentation:
34
+ Exclude:
35
+ - 'spec/**/*'
36
+ - 'test/**/*'
37
+ - 'lib/csvbuilder/dynamic/columns/exporter/concerns/export/dynamic_columns.rb'
38
+ - 'lib/csvbuilder/dynamic/columns/exporter/internal/export/dynamic_column_attribute.rb'
39
+
40
+ # Offense count: 2
41
+ Style/OpenStructUse:
42
+ Exclude:
43
+ - 'spec/csvbuilder/dynamic/columns/exporter/internal/export/dynamic_column_attribute_spec.rb'
44
+ - 'spec/support/fixtures/concerns/attributes.rb'
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-12-21
4
+
5
+ - Initial release
@@ -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,16 @@
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"
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-exporter"
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-exporter"
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-exporter"
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
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "csvbuilder/dynamic/columns/core/concerns/dynamic_columns_base"
4
+ require "csvbuilder/exporter/concerns/export/attributes"
5
+ require "csvbuilder/dynamic/columns/exporter/internal/export/dynamic_column_attribute"
6
+
7
+ module Csvbuilder
8
+ module Export
9
+ module DynamicColumns
10
+ extend ActiveSupport::Concern
11
+ include DynamicColumnsBase
12
+
13
+ included do
14
+ ensure_define_dynamic_attribute_method
15
+ end
16
+
17
+ def dynamic_column_attribute_objects
18
+ @dynamic_column_attribute_objects ||= array_to_block_hash(self.class.dynamic_column_names) do |column_name|
19
+ self.class.dynamic_attribute_class.new(column_name, self)
20
+ end
21
+ end
22
+
23
+ # @return [Array] an array of public_send(column_name) of the CSV model
24
+ def to_row
25
+ super.flatten
26
+ end
27
+
28
+ class_methods do
29
+ def dynamic_attribute_class
30
+ DynamicColumnAttribute
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "csvbuilder/dynamic/columns/core/internal/dynamic_column_attribute_base"
4
+
5
+ module Csvbuilder
6
+ module Export
7
+ class DynamicColumnAttribute < Csvbuilder::DynamicColumnAttributeBase
8
+ def unformatted_value
9
+ formatted_cells
10
+ end
11
+
12
+ def source_cells
13
+ header_models.map { |header_model| call_process_cell(header_model) }
14
+ end
15
+
16
+ class << self
17
+ def define_process_cell(row_model_class, column_name)
18
+ super { |header_model| header_model }
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "csvbuilder/exporter/public/export"
4
+
5
+ require "csvbuilder/dynamic/columns/exporter/concerns/export/dynamic_columns"
6
+ Csvbuilder::Export.include(Csvbuilder::Export::DynamicColumns)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Csvbuilder
4
+ module Dynamic
5
+ module Columns
6
+ module Exporter
7
+ VERSION = "0.1.0"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "csvbuilder/dynamic/columns/exporter/version"
4
+
5
+ require "csvbuilder/core"
6
+ require "csvbuilder/exporter"
7
+ require "csvbuilder/dynamic/columns/core"
8
+
9
+ require "csvbuilder/dynamic/columns/core/public/model"
10
+
11
+ require "csvbuilder/dynamic/columns/exporter/public/export"
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: csvbuilder-dynamic-columns-exporter
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-exporter
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
+ - LICENSE.txt
90
+ - README.md
91
+ - Rakefile
92
+ - gemfiles/Gemfile.5.2._gemfile
93
+ - gemfiles/Gemfile.6.1._gemfile
94
+ - gemfiles/Gemfile.7.0._gemfile
95
+ - lib/.DS_Store
96
+ - lib/csvbuilder/.DS_Store
97
+ - lib/csvbuilder/dynamic/.DS_Store
98
+ - lib/csvbuilder/dynamic/columns/.DS_Store
99
+ - lib/csvbuilder/dynamic/columns/exporter.rb
100
+ - lib/csvbuilder/dynamic/columns/exporter/.DS_Store
101
+ - lib/csvbuilder/dynamic/columns/exporter/concerns/.DS_Store
102
+ - lib/csvbuilder/dynamic/columns/exporter/concerns/export/dynamic_columns.rb
103
+ - lib/csvbuilder/dynamic/columns/exporter/internal/.DS_Store
104
+ - lib/csvbuilder/dynamic/columns/exporter/internal/export/dynamic_column_attribute.rb
105
+ - lib/csvbuilder/dynamic/columns/exporter/public/.DS_Store
106
+ - lib/csvbuilder/dynamic/columns/exporter/public/export.rb
107
+ - lib/csvbuilder/dynamic/columns/exporter/version.rb
108
+ homepage: https://github.com/joel/csvbuilder-dynamic-columns-exporter
109
+ licenses:
110
+ - MIT
111
+ metadata:
112
+ homepage_uri: https://github.com/joel/csvbuilder-dynamic-columns-exporter
113
+ source_code_uri: https://github.com/joel/csvbuilder-dynamic-columns-exporter
114
+ changelog_uri: https://github.com/joel/csvbuilder-dynamic-columns-exporter/blob/main/CHANGELOG.md
115
+ rubygems_mfa_required: 'true'
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 2.6.0
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubygems_version: 3.3.22
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: Csvbuilder Dynamic Columns contain the components to handle CSV dynamic columns
135
+ test_files: []