csb 0.9.0 → 0.11.0

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: 838fb73c6e13f3232f1fac402667ff00e92ac6f7f814d8605d2b850f52e449cc
4
- data.tar.gz: 8c0016c9bff8210a55882ba0afa442d5fd9efca701800cc031a13ecfbe6ef21b
3
+ metadata.gz: 549b384457905e2f88bfe785d2c9bd241a1c7f18e920962005c41d2d8c0162e8
4
+ data.tar.gz: e750c534760f3b5d7ca412df629e6e55cdc22b10b416e2352adfa755ab718529
5
5
  SHA512:
6
- metadata.gz: 679a875a5174204aa3cfdc5713083c5a25be1c704049ff63a84e5969e9ecc6a582804d15177a3febd86fbb58e614772556d78730df10f3bef266a14644e968e4
7
- data.tar.gz: abfb009c641e057a4d6b35992e409d9de8329d598dc0c61a2689a0cbef1564b247e813d1bf740d4572dedb38557bbd82f73f47b934ccf0fd82c2dbdd10424bcc
6
+ metadata.gz: fcf7c87da0ffa9333d8ceff7f4be1c6dba4d3a91001c83b23ce50c74e4668601b3189059c7918e7810141c15158aa94868db478b1942717f6c2500016f0155bb
7
+ data.tar.gz: 54b1d2903c89cf84ed7d7a1eda786cdc07fceca412e4b076e6eb9688d0a6077574094756bd7796c2e8ee6139de5950132ee398212e7ed332bf73753cf02bb828
@@ -16,12 +16,9 @@ jobs:
16
16
  fail-fast: false
17
17
  matrix:
18
18
  ruby: ["3.0", "3.1", "3.2", "3.3"]
19
- gemfile: ["rails61", "rails70"]
20
- exclude:
21
- - ruby: "3.1"
22
- gemfile: "rails61"
19
+ gemfile: ["rails70", "rails71"]
23
20
  steps:
24
- - uses: actions/checkout@v3
21
+ - uses: actions/checkout@v4
25
22
 
26
23
  - name: Set up Ruby
27
24
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
+ ## 0.11.0
2
+
3
+ - Consider `Csb.configuration` as initial value for `Csb::Builder`
4
+
5
+ ## 0.10.0
6
+
7
+ - Drop support for rails 6.1
8
+
1
9
  ## 0.9.0
2
10
 
3
- - Fixing Issue with config.streaming Enabled in Rails 7.1 (#17)
11
+ - Fixing Issue with config.streaming Enabled in Rails 7.1 (https://github.com/aki77/csb/pull/17)
4
12
 
5
13
  ## 0.8.0
6
14
 
data/csb.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.required_ruby_version = '>= 3.0.0'
26
26
 
27
- spec.add_dependency "rails", ">= 6.1.0"
27
+ spec.add_dependency "rails", ">= 7.0.0"
28
28
  spec.add_dependency "csv"
29
29
 
30
30
  spec.add_development_dependency "bundler", "~> 2.0"
@@ -1,5 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'rails', '~> 6.0.0'
3
+ gem 'rails', '~> 7.1.0'
4
4
 
5
5
  gemspec path: '../'
data/lib/csb/builder.rb CHANGED
@@ -8,12 +8,12 @@ module Csb
8
8
  attr_reader :output, :utf8_bom, :items, :cols, :csv_options
9
9
  attr_accessor :items
10
10
 
11
- def initialize(output = '', items: [], utf8_bom: false, csv_options: {})
11
+ def initialize(output = '', items: [], **kwargs)
12
12
  @output = output
13
- @utf8_bom = utf8_bom
14
13
  @cols = Cols.new
15
14
  @items = items
16
- @csv_options = csv_options
15
+ @utf8_bom = kwargs.fetch(:utf8_bom) { Csb.configuration.utf8_bom }
16
+ @csv_options = kwargs.fetch(:csv_options) { Csb.configuration.csv_options }
17
17
  end
18
18
 
19
19
  def build
data/lib/csb/handler.rb CHANGED
@@ -12,9 +12,7 @@ module Csb
12
12
 
13
13
  <<~RUBY
14
14
  csv = ::Csb::Template.new(
15
- utf8_bom: ::Csb.configuration.utf8_bom,
16
15
  streaming: ::Csb.configuration.streaming,
17
- csv_options: ::Csb.configuration.csv_options,
18
16
  )
19
17
  #{source}
20
18
  controller.send(:send_file_headers!, type: 'text/csv', filename: csv.filename)
data/lib/csb/template.rb CHANGED
@@ -2,10 +2,8 @@ module Csb
2
2
  class Template
3
3
  attr_accessor :utf8_bom, :filename, :streaming, :items, :cols, :csv_options
4
4
 
5
- def initialize(utf8_bom:, streaming:, csv_options:)
6
- @utf8_bom = utf8_bom
5
+ def initialize(streaming:)
7
6
  @streaming = streaming
8
- @csv_options = csv_options
9
7
  @cols = Cols.new
10
8
  @items = []
11
9
  end
@@ -20,8 +18,16 @@ module Csb
20
18
 
21
19
  private
22
20
 
21
+ def builder_options
22
+ {
23
+ items: items,
24
+ utf8_bom: utf8_bom,
25
+ csv_options: csv_options,
26
+ }.compact
27
+ end
28
+
23
29
  def build_string
24
- builder = Builder.new(utf8_bom: utf8_bom, items: items, csv_options: csv_options)
30
+ builder = Builder.new(**builder_options)
25
31
  builder.cols.copy!(cols)
26
32
  builder.build
27
33
  end
@@ -29,7 +35,7 @@ module Csb
29
35
  def build_enumerator
30
36
  Enumerator.new do |y|
31
37
  begin
32
- builder = Builder.new(y, utf8_bom: utf8_bom, items: items, csv_options: csv_options)
38
+ builder = Builder.new(y, **builder_options)
33
39
  builder.cols.copy!(cols)
34
40
  builder.build
35
41
  rescue => error
data/lib/csb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Csb
2
- VERSION = '0.9.0'
2
+ VERSION = '0.11.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-19 00:00:00.000000000 Z
11
+ date: 2024-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 6.1.0
19
+ version: 7.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 6.1.0
26
+ version: 7.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: csv
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -99,9 +99,8 @@ files:
99
99
  - bin/console
100
100
  - bin/setup
101
101
  - csb.gemspec
102
- - gemfiles/rails60.gemfile
103
- - gemfiles/rails61.gemfile
104
102
  - gemfiles/rails70.gemfile
103
+ - gemfiles/rails71.gemfile
105
104
  - lib/csb.rb
106
105
  - lib/csb/builder.rb
107
106
  - lib/csb/col.rb
@@ -131,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
130
  - !ruby/object:Gem::Version
132
131
  version: '0'
133
132
  requirements: []
134
- rubygems_version: 3.4.10
133
+ rubygems_version: 3.5.3
135
134
  signing_key:
136
135
  specification_version: 4
137
136
  summary: A simple and streaming support CSV template engine for Ruby on Rails.
@@ -1,5 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem 'rails', '~> 6.1.0'
4
-
5
- gemspec path: '../'