csvbuilder-core 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -5
- data/.rubocop_todo.yml +9 -17
- data/.tool-versions +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +72 -47
- data/gemfiles/Gemfile.7.0._gemfile +1 -0
- data/gemfiles/{Gemfile.5.2._gemfile → Gemfile.8.0._gemfile} +2 -1
- data/lib/csvbuilder/core/concerns/attributes_base.rb +4 -4
- data/lib/csvbuilder/core/concerns/model/attributes.rb +12 -1
- data/lib/csvbuilder/core/concerns/proxy.rb +2 -2
- data/lib/csvbuilder/core/version.rb +1 -1
- metadata +19 -14
- data/gemfiles/Gemfile.6.1._gemfile +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bebbe955151405fc7bd5fed00c2e89c7138751d51c9bc60da989eef55bc11249
|
4
|
+
data.tar.gz: 0af4007a61548b597e3f51e742eb6f687a4ee0978bbb66867079c75895f514a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41b04fe27507ac07e996d0fdd8e75e13dea278e65151095eb1223d588def3dd1b3b62ca7e066e2c43a9b4b9d2a56a32f3412a0e01ecd39cab0c45fea523cadcf
|
7
|
+
data.tar.gz: f3bb2943717a98ca9d93dc357842ed78f2072fc54e9ec730d5fbedae648f770c21faf5500c7644fc57fde4455345eda0b848f4747abcecc55585d774c2e8d822
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
-
|
3
|
+
plugins:
|
4
4
|
- rubocop-performance
|
5
5
|
- rubocop-rake
|
6
6
|
- rubocop-rspec
|
7
7
|
|
8
8
|
AllCops:
|
9
9
|
NewCops: enable
|
10
|
-
TargetRubyVersion: 2
|
10
|
+
TargetRubyVersion: 3.4.2
|
11
11
|
|
12
12
|
Style/StringLiterals:
|
13
13
|
Enabled: true
|
@@ -16,6 +16,3 @@ Style/StringLiterals:
|
|
16
16
|
Style/StringLiteralsInInterpolation:
|
17
17
|
Enabled: true
|
18
18
|
EnforcedStyle: double_quotes
|
19
|
-
|
20
|
-
Layout/LineLength:
|
21
|
-
Max: 120
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-09-05 09:08:13 UTC using RuboCop version 1.56.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -8,29 +8,21 @@
|
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
10
|
# This cop supports safe autocorrection (--autocorrect).
|
11
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns
|
11
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
12
12
|
# URISchemes: http, https
|
13
13
|
Layout/LineLength:
|
14
14
|
Max: 147
|
15
|
-
Exclude:
|
16
|
-
- 'lib/csvbuilder/core/concerns/attributes_base.rb'
|
17
15
|
|
18
|
-
# Offense count:
|
19
|
-
# Configuration parameters:
|
20
|
-
RSpec/
|
21
|
-
|
16
|
+
# Offense count: 2
|
17
|
+
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
18
|
+
RSpec/IndexedLet:
|
19
|
+
Exclude:
|
20
|
+
- 'spec/csvbuilder/core/concerns/proxy_spec.rb'
|
22
21
|
|
23
|
-
# Offense count:
|
22
|
+
# Offense count: 2
|
24
23
|
RSpec/MultipleExpectations:
|
25
24
|
Max: 3
|
26
25
|
|
27
|
-
# Offense count: 1
|
28
|
-
# Configuration parameters: AllowedPatterns.
|
29
|
-
# AllowedPatterns: ^expect_, ^assert_
|
30
|
-
RSpec/NoExpectationExample:
|
31
|
-
Exclude:
|
32
|
-
- 'spec/support/shared_examples/methods/define_attribute_method.rb'
|
33
|
-
|
34
26
|
# Offense count: 7
|
35
27
|
# Configuration parameters: AllowedConstants.
|
36
28
|
Style/Documentation:
|
@@ -50,4 +42,4 @@ Style/OpenStructUse:
|
|
50
42
|
Exclude:
|
51
43
|
- 'lib/csvbuilder/core/concerns/model/base.rb'
|
52
44
|
- 'lib/csvbuilder/core/internal/model/header.rb'
|
53
|
-
- 'spec/support/fixtures/concerns/basic_attributes.rb'
|
45
|
+
- 'spec/support/fixtures/concerns/basic_attributes.rb'
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.4.2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,71 +1,96 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
csvbuilder-core (0.1.
|
5
|
-
activesupport (>= 5.2
|
4
|
+
csvbuilder-core (0.1.4)
|
5
|
+
activesupport (>= 5.2)
|
6
|
+
csv
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
activesupport (7.
|
11
|
-
|
11
|
+
activesupport (7.2.2.1)
|
12
|
+
base64
|
13
|
+
benchmark (>= 0.3)
|
14
|
+
bigdecimal
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
12
18
|
i18n (>= 1.6, < 2)
|
19
|
+
logger (>= 1.4.2)
|
13
20
|
minitest (>= 5.1)
|
14
|
-
|
21
|
+
securerandom (>= 0.3)
|
22
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
15
23
|
ast (2.4.2)
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
base64 (0.2.0)
|
25
|
+
benchmark (0.4.0)
|
26
|
+
bigdecimal (3.1.9)
|
27
|
+
concurrent-ruby (1.3.5)
|
28
|
+
connection_pool (2.5.0)
|
29
|
+
csv (3.3.2)
|
30
|
+
diff-lcs (1.6.0)
|
31
|
+
drb (2.2.1)
|
32
|
+
i18n (1.14.7)
|
19
33
|
concurrent-ruby (~> 1.0)
|
20
|
-
json (2.
|
21
|
-
|
22
|
-
|
23
|
-
|
34
|
+
json (2.10.1)
|
35
|
+
language_server-protocol (3.17.0.4)
|
36
|
+
lint_roller (1.1.0)
|
37
|
+
logger (1.6.6)
|
38
|
+
minitest (5.25.4)
|
39
|
+
parallel (1.26.3)
|
40
|
+
parser (3.3.7.1)
|
24
41
|
ast (~> 2.4.1)
|
42
|
+
racc
|
43
|
+
racc (1.8.1)
|
25
44
|
rainbow (3.1.1)
|
26
|
-
rake (13.
|
27
|
-
regexp_parser (2.
|
28
|
-
|
29
|
-
|
30
|
-
rspec-
|
31
|
-
rspec-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
rspec-expectations (3.12.1)
|
45
|
+
rake (13.2.1)
|
46
|
+
regexp_parser (2.10.0)
|
47
|
+
rspec (3.13.0)
|
48
|
+
rspec-core (~> 3.13.0)
|
49
|
+
rspec-expectations (~> 3.13.0)
|
50
|
+
rspec-mocks (~> 3.13.0)
|
51
|
+
rspec-core (3.13.3)
|
52
|
+
rspec-support (~> 3.13.0)
|
53
|
+
rspec-expectations (3.13.3)
|
36
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-mocks (3.
|
55
|
+
rspec-support (~> 3.13.0)
|
56
|
+
rspec-mocks (3.13.2)
|
39
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-support (3.
|
42
|
-
rubocop (1.
|
58
|
+
rspec-support (~> 3.13.0)
|
59
|
+
rspec-support (3.13.2)
|
60
|
+
rubocop (1.72.2)
|
43
61
|
json (~> 2.3)
|
62
|
+
language_server-protocol (~> 3.17.0.2)
|
63
|
+
lint_roller (~> 1.1.0)
|
44
64
|
parallel (~> 1.10)
|
45
|
-
parser (>= 3.
|
65
|
+
parser (>= 3.3.0.2)
|
46
66
|
rainbow (>= 2.2.2, < 4.0)
|
47
|
-
regexp_parser (>=
|
48
|
-
|
49
|
-
rubocop-ast (>= 1.23.0, < 2.0)
|
67
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
68
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
50
69
|
ruby-progressbar (~> 1.7)
|
51
|
-
unicode-display_width (>=
|
52
|
-
rubocop-ast (1.
|
53
|
-
parser (>= 3.
|
54
|
-
rubocop-performance (1.
|
55
|
-
|
56
|
-
rubocop
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
rubocop (
|
61
|
-
|
62
|
-
|
70
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
71
|
+
rubocop-ast (1.38.1)
|
72
|
+
parser (>= 3.3.1.0)
|
73
|
+
rubocop-performance (1.24.0)
|
74
|
+
lint_roller (~> 1.1)
|
75
|
+
rubocop (>= 1.72.1, < 2.0)
|
76
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
77
|
+
rubocop-rake (0.7.1)
|
78
|
+
lint_roller (~> 1.1)
|
79
|
+
rubocop (>= 1.72.1)
|
80
|
+
rubocop-rspec (3.5.0)
|
81
|
+
lint_roller (~> 1.1)
|
82
|
+
rubocop (~> 1.72, >= 1.72.1)
|
83
|
+
ruby-progressbar (1.13.0)
|
84
|
+
securerandom (0.4.1)
|
85
|
+
tzinfo (2.0.6)
|
63
86
|
concurrent-ruby (~> 1.0)
|
64
|
-
unicode-display_width (
|
87
|
+
unicode-display_width (3.1.4)
|
88
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
89
|
+
unicode-emoji (4.0.4)
|
65
90
|
|
66
91
|
PLATFORMS
|
67
|
-
arm64-darwin-
|
68
|
-
|
92
|
+
arm64-darwin-24
|
93
|
+
ruby
|
69
94
|
|
70
95
|
DEPENDENCIES
|
71
96
|
csvbuilder-core!
|
@@ -77,4 +102,4 @@ DEPENDENCIES
|
|
77
102
|
rubocop-rspec
|
78
103
|
|
79
104
|
BUNDLED WITH
|
80
|
-
2.
|
105
|
+
2.6.2
|
@@ -56,8 +56,8 @@ module Csvbuilder
|
|
56
56
|
array_to_block_hash(column_names) { |column_name| attribute_objects[column_name].public_send(attribute_method) }
|
57
57
|
end
|
58
58
|
|
59
|
-
def array_to_block_hash(array, &
|
60
|
-
array.zip(array.map(&
|
59
|
+
def array_to_block_hash(array, &)
|
60
|
+
array.zip(array.map(&)).to_h
|
61
61
|
end
|
62
62
|
|
63
63
|
class_methods do
|
@@ -69,10 +69,10 @@ module Csvbuilder
|
|
69
69
|
|
70
70
|
# Define default attribute method for a column
|
71
71
|
# @param column_name [Symbol] the cell's column_name
|
72
|
-
def define_attribute_method(column_name, &
|
72
|
+
def define_attribute_method(column_name, &)
|
73
73
|
return if method_defined? column_name
|
74
74
|
|
75
|
-
define_proxy_method(column_name, &
|
75
|
+
define_proxy_method(column_name, &)
|
76
76
|
end
|
77
77
|
|
78
78
|
def ensure_attribute_method
|
@@ -15,6 +15,10 @@ module Csvbuilder
|
|
15
15
|
self.class.headers(context)
|
16
16
|
end
|
17
17
|
|
18
|
+
def column_header(column_header)
|
19
|
+
self.class.column_header(column_header, context)
|
20
|
+
end
|
21
|
+
|
18
22
|
class_methods do
|
19
23
|
# @return [Array<Symbol>] column names for the row model
|
20
24
|
def column_names
|
@@ -30,7 +34,7 @@ module Csvbuilder
|
|
30
34
|
# @param [Hash, OpenStruct] context name of column to check
|
31
35
|
# @return [Array] column headers for the row model
|
32
36
|
def headers(context = {})
|
33
|
-
column_names.map { |column_name|
|
37
|
+
column_names.map { |column_name| column_header(column_name, context) }
|
34
38
|
end
|
35
39
|
|
36
40
|
# Safe to override
|
@@ -52,6 +56,13 @@ module Csvbuilder
|
|
52
56
|
self._columns ||= {}
|
53
57
|
end
|
54
58
|
|
59
|
+
# @param context [Hash, OpenStruct] name of column to check
|
60
|
+
# @param column_name [Symbol] the cell's column_name
|
61
|
+
# @return [String] column header
|
62
|
+
def column_header(column_name, context = {})
|
63
|
+
Header.new(column_name, self, context).value
|
64
|
+
end
|
65
|
+
|
55
66
|
protected
|
56
67
|
|
57
68
|
# Adds column to the row model
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csvbuilder-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Azemar
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-26 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -17,9 +16,6 @@ dependencies:
|
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '5.2'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '8'
|
23
19
|
type: :runtime
|
24
20
|
prerelease: false
|
25
21
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +23,20 @@ dependencies:
|
|
27
23
|
- - ">="
|
28
24
|
- !ruby/object:Gem::Version
|
29
25
|
version: '5.2'
|
30
|
-
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: csv
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
31
38
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
39
|
+
version: '0'
|
33
40
|
description: Help handle CSVs in a more efficient way
|
34
41
|
email:
|
35
42
|
- joel.azemar@gmail.com
|
@@ -40,6 +47,7 @@ files:
|
|
40
47
|
- ".rspec"
|
41
48
|
- ".rubocop.yml"
|
42
49
|
- ".rubocop_todo.yml"
|
50
|
+
- ".tool-versions"
|
43
51
|
- CHANGELOG.md
|
44
52
|
- CODE_OF_CONDUCT.md
|
45
53
|
- Gemfile
|
@@ -47,9 +55,8 @@ files:
|
|
47
55
|
- LICENSE.txt
|
48
56
|
- README.md
|
49
57
|
- Rakefile
|
50
|
-
- gemfiles/Gemfile.5.2._gemfile
|
51
|
-
- gemfiles/Gemfile.6.1._gemfile
|
52
58
|
- gemfiles/Gemfile.7.0._gemfile
|
59
|
+
- gemfiles/Gemfile.8.0._gemfile
|
53
60
|
- lib/csvbuilder/core.rb
|
54
61
|
- lib/csvbuilder/core/concerns/attributes_base.rb
|
55
62
|
- lib/csvbuilder/core/concerns/model/attributes.rb
|
@@ -69,7 +76,6 @@ metadata:
|
|
69
76
|
source_code_uri: https://github.com/joel/csvbuilder-core
|
70
77
|
changelog_uri: https://github.com/joel/csvbuilder-core/blob/main/CHANGELOG.md
|
71
78
|
rubygems_mfa_required: 'true'
|
72
|
-
post_install_message:
|
73
79
|
rdoc_options: []
|
74
80
|
require_paths:
|
75
81
|
- lib
|
@@ -77,15 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
83
|
requirements:
|
78
84
|
- - ">="
|
79
85
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
86
|
+
version: '3.4'
|
81
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
88
|
requirements:
|
83
89
|
- - ">="
|
84
90
|
- !ruby/object:Gem::Version
|
85
91
|
version: '0'
|
86
92
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
88
|
-
signing_key:
|
93
|
+
rubygems_version: 3.6.2
|
89
94
|
specification_version: 4
|
90
95
|
summary: Csvbuilder Core contain the shared components of Csvbuilder
|
91
96
|
test_files: []
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
# Runtime dependencies
|
6
|
-
gem "activesupport", "~> 6.1"
|
7
|
-
|
8
|
-
# Development dependencies
|
9
|
-
gem "rake"
|
10
|
-
gem "rspec"
|
11
|
-
gem "rubocop"
|
12
|
-
gem "rubocop-performance"
|
13
|
-
gem "rubocop-rake"
|
14
|
-
gem "rubocop-rspec"
|