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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7be65a3637e42b4ec99f9ebc795479ac8b629fa5921fe892784c928ce788789
4
- data.tar.gz: 65e07ac9fdedb085aa6850ae58cba1d1b530275b4dfe6c39edbb28b3ab8f6db5
3
+ metadata.gz: bebbe955151405fc7bd5fed00c2e89c7138751d51c9bc60da989eef55bc11249
4
+ data.tar.gz: 0af4007a61548b597e3f51e742eb6f687a4ee0978bbb66867079c75895f514a6
5
5
  SHA512:
6
- metadata.gz: 0fb1213ba385c60faecc0f4a943ffd71328f215609bf4b876f0c641691f52d6caa545c621ba1b3ebb4df7be6a9a58c51cef2679754786abb90ada1cbd1321aab
7
- data.tar.gz: e816c1c62f4e22a16d416f82abefbc502c523d2656700140fee941d84a7051e82ab65798dad21eb43e044c0c4e863339e0ae27b2d2a104d205619fce9b2eee66
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
- require:
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.6
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 2022-12-16 10:22:17 UTC using RuboCop version 1.39.0.
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, IgnoredPatterns.
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: 1
19
- # Configuration parameters: CountAsOne.
20
- RSpec/ExampleLength:
21
- Max: 6
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: 4
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
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.4] - 2025-02-26
4
+
5
+ - Adding Csvbuilder::Model::Attributes#column_header by [Michael Keene](https://github.com/Michaelkeene)
6
+
3
7
  ## [0.1.3] - 2023-03-03
4
8
 
5
9
  Add Header default formatting
data/Gemfile.lock CHANGED
@@ -1,71 +1,96 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- csvbuilder-core (0.1.3)
5
- activesupport (>= 5.2, < 8)
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.0.4)
11
- concurrent-ruby (~> 1.0, >= 1.0.2)
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
- tzinfo (~> 2.0)
21
+ securerandom (>= 0.3)
22
+ tzinfo (~> 2.0, >= 2.0.5)
15
23
  ast (2.4.2)
16
- concurrent-ruby (1.1.10)
17
- diff-lcs (1.5.0)
18
- i18n (1.12.0)
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.6.3)
21
- minitest (5.16.3)
22
- parallel (1.22.1)
23
- parser (3.1.3.0)
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.0.6)
27
- regexp_parser (2.6.1)
28
- rexml (3.2.5)
29
- rspec (3.12.0)
30
- rspec-core (~> 3.12.0)
31
- rspec-expectations (~> 3.12.0)
32
- rspec-mocks (~> 3.12.0)
33
- rspec-core (3.12.0)
34
- rspec-support (~> 3.12.0)
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.12.0)
38
- rspec-mocks (3.12.1)
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.12.0)
41
- rspec-support (3.12.0)
42
- rubocop (1.41.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.1.2.1)
65
+ parser (>= 3.3.0.2)
46
66
  rainbow (>= 2.2.2, < 4.0)
47
- regexp_parser (>= 1.8, < 3.0)
48
- rexml (>= 3.2.5, < 4.0)
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 (>= 1.4.0, < 3.0)
52
- rubocop-ast (1.24.0)
53
- parser (>= 3.1.1.0)
54
- rubocop-performance (1.15.2)
55
- rubocop (>= 1.7.0, < 2.0)
56
- rubocop-ast (>= 0.4.0)
57
- rubocop-rake (0.6.0)
58
- rubocop (~> 1.0)
59
- rubocop-rspec (2.16.0)
60
- rubocop (~> 1.33)
61
- ruby-progressbar (1.11.0)
62
- tzinfo (2.0.5)
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 (2.3.0)
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-21
68
- arm64-darwin-22
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.4.2
105
+ 2.6.2
@@ -4,6 +4,7 @@ source "https://rubygems.org"
4
4
 
5
5
  # Runtime dependencies
6
6
  gem "activesupport", "~> 7.0"
7
+ gem "csv"
7
8
 
8
9
  # Development dependencies
9
10
  gem "rake"
@@ -3,7 +3,8 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  # Runtime dependencies
6
- gem "activesupport", "~> 5.2"
6
+ gem "activesupport", "~> 8.0"
7
+ gem "csv"
7
8
 
8
9
  # Development dependencies
9
10
  gem "rake"
@@ -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, &block)
60
- array.zip(array.map(&block)).to_h
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, &block)
72
+ def define_attribute_method(column_name, &)
73
73
  return if method_defined? column_name
74
74
 
75
- define_proxy_method(column_name, &block)
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| Header.new(column_name, self, context).value }
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
@@ -9,8 +9,8 @@ module Csvbuilder
9
9
  @proxy ||= Module.new.tap { |mod| include mod }
10
10
  end
11
11
 
12
- def define_proxy_method(*args, &block)
13
- proxy.send(:define_method, *args, &block)
12
+ def define_proxy_method(*, &)
13
+ proxy.send(:define_method, *, &)
14
14
  end
15
15
  end
16
16
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Csvbuilder
4
4
  module Core
5
- VERSION = "0.1.3"
5
+ VERSION = "0.1.4"
6
6
  end
7
7
  end
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.3
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: 2023-03-03 00:00:00.000000000 Z
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: '8'
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: 2.6.0
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.4.6
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"