rggen-spreadsheet-loader 0.19.0 → 0.20.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: 9a9e3cd2d0e9852524f09edcecf3d62cab2a6b496f4f59571052cb0c7b879aba
4
- data.tar.gz: 491fb225fd336ccc3640d1359849fe0383850e1d94b0a70502dbccdec111191d
3
+ metadata.gz: e0f3c849dfe3a2e44abfe3dc1014c4a4254fe8be92bdd4b64745fd1778cb0b42
4
+ data.tar.gz: 690e61fab0e402d9171aa2ee50befbf25111ad44810acf01cd5c9af11fba7e8f
5
5
  SHA512:
6
- metadata.gz: 88dd693a44503622b944dc5ddead75f8c1845ba48ab8dd9c7e1ff2d69096f6e491ae6dbb67ad0f96015e9dcdbc8dfd04761ced92a289cff893f13fbbad04dc91
7
- data.tar.gz: e1544ef459e4f3dc3a4ade4e8d5396b66d9be1f4eaac30adaf77e0330c9bd08567ed8ae520712e77c77edd2831aaafb06665ece1f94dc5a7f8cd475df20bfe5a
6
+ metadata.gz: 23770bfa1f24804808d6c75885f07338831f18833147c165783b8dd1bac3edde07e90f281f1ed2f326fcf71487ff972bb1f14353d08142491660a68997b57676
7
+ data.tar.gz: e162d610aa891cd2928370e9cb8f9bf6d4057be34f344efc855de1539ecc2b743054c4d00d4209a999747facbe579cf947fc8cdae44f2c36e72dfbd29cf33c40
@@ -8,19 +8,22 @@ module RgGen
8
8
  support_types [:xlsx, :ods]
9
9
 
10
10
  def read_spreadsheet(file, book)
11
- read_roo(file) do |pagename, page|
12
- book.add_sheet(pagename, collect_cells(page))
13
- end
11
+ read_roo(file, &page_processor(book))
14
12
  end
15
13
 
16
14
  private
17
15
 
18
- def read_roo(file)
16
+ def read_roo(file, &block)
19
17
  require 'roo'
20
18
  Roo::Spreadsheet.open(file, extension: File.extname(file))
21
- .each_with_pagename do |pagename, page|
22
- page.first_row && yield(pagename, page)
23
- end
19
+ .each_with_pagename(&block)
20
+ end
21
+
22
+ def page_processor(book)
23
+ lambda do |pagename_and_page|
24
+ pagename, page = pagename_and_page
25
+ page.first_row && book.add_sheet(pagename, collect_cells(page))
26
+ end
24
27
  end
25
28
 
26
29
  def collect_cells(page)
@@ -58,7 +58,8 @@ module RgGen
58
58
  end
59
59
 
60
60
  def collect_register_data(sheet)
61
- sheet.rows(register_start_position.row)
61
+ sheet
62
+ .rows(register_start_position.row)
62
63
  .reject { |row| row.cells.all?(&:empty_cell?) }
63
64
  .each_with_object([], &method(:collect_register_rows))
64
65
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RgGen
4
4
  module SpreadsheetLoader
5
- VERSION = '0.19.0'
5
+ VERSION = '0.20.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen-spreadsheet-loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taichi Ishitani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roo
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
- version: '2.4'
93
+ version: '2.5'
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
@@ -100,5 +100,5 @@ requirements: []
100
100
  rubygems_version: 3.2.3
101
101
  signing_key:
102
102
  specification_version: 4
103
- summary: rggen-spreadsheet-loader-0.19.0
103
+ summary: rggen-spreadsheet-loader-0.20.0
104
104
  test_files: []