rggen-spreadsheet-loader 0.18.0 → 0.18.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb30337ed0f7670b7a30412298d500efc2c43a68b23c62cb24710cbd177d6712
|
4
|
+
data.tar.gz: 120d91e46af469f9843844afcfdf1d2ec736bada9d57b5405db9ae16bd52aa49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baaede9d7b9dcdcbe08c7671a17da7ae8847cab6d6f5ab9f0c1154419bd321256a7951414f70e0aa5f9b56d6ef452ecd87027ddcf39ecc9f4f16537d6a9300ed
|
7
|
+
data.tar.gz: b2bf6f9e744ba823cdcbc77b776f59805c9df88ebd107fa9e18830d5baf0396743989da7e7576fb29f2d3fa1be2d1c240abbd114018f86d3c8bf7bbc55616a51
|
@@ -5,7 +5,7 @@ module RgGen
|
|
5
5
|
class CSVLoader < Core::RegisterMap::Loader
|
6
6
|
include SpreadsheetLoader
|
7
7
|
|
8
|
-
support_types [:csv]
|
8
|
+
support_types [:csv, :tsv]
|
9
9
|
|
10
10
|
def read_spreadsheet(file, book)
|
11
11
|
sheet = read_csv(file)
|
@@ -17,7 +17,12 @@ module RgGen
|
|
17
17
|
|
18
18
|
def read_csv(file)
|
19
19
|
require 'csv'
|
20
|
-
CSV.read(file)
|
20
|
+
CSV.read(file, col_sep: separator(file))
|
21
|
+
end
|
22
|
+
|
23
|
+
def separator(file)
|
24
|
+
ext = File.extname(file)
|
25
|
+
ext.casecmp?('.tsv') && "\t" || ','
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
@@ -59,11 +59,16 @@ module RgGen
|
|
59
59
|
def collect_register_data(sheet)
|
60
60
|
sheet.rows(register_start_position.row)
|
61
61
|
.reject { |row| row.cells.all?(&:empty_cell?) }
|
62
|
-
.each_with_object([]
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
.each_with_object([], &method(:collect_register_rows))
|
63
|
+
end
|
64
|
+
|
65
|
+
def collect_register_rows(row, row_sets)
|
66
|
+
register_begin?(row) && (row_sets << [])
|
67
|
+
row_sets.last << row
|
68
|
+
end
|
69
|
+
|
70
|
+
def register_begin?(row)
|
71
|
+
!row[register_start_position.column].empty_cell?
|
67
72
|
end
|
68
73
|
|
69
74
|
def collect_bit_field_data(rows)
|
@@ -81,11 +86,11 @@ module RgGen
|
|
81
86
|
|
82
87
|
def bit_field_start_position
|
83
88
|
@bit_field_start_position ||=
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
+
Position.new(0, bit_field_start_column)
|
90
|
+
end
|
91
|
+
|
92
|
+
def bit_field_start_column
|
93
|
+
register_start_position.column + valid_values(:register).size
|
89
94
|
end
|
90
95
|
end
|
91
96
|
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.18.
|
4
|
+
version: 0.18.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roo
|
@@ -100,5 +100,5 @@ requirements: []
|
|
100
100
|
rubygems_version: 3.1.2
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
|
-
summary: rggen-spreadsheet-loader-0.18.
|
103
|
+
summary: rggen-spreadsheet-loader-0.18.2
|
104
104
|
test_files: []
|