data_list_converter 0.6.0 → 0.6.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7d81ea2f102f4cfbe046e304bcbc657d434a75c74166430a64cf88193ef9a84
|
4
|
+
data.tar.gz: c9009ebe7e79f115cef59d5c6bb350cca6589114dd0790edc19eaeb1d050254b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07ad78cd3c67b635795d30838a5bab7144a50daec3bbce112be1c22292b79199e46311d76a067ae7d330d15ede2fc596a0772324c53b09372dc456bd4131b7a9
|
7
|
+
data.tar.gz: 5981c7dade36e0c2817f748f93caeb1025040b297048103f980bb9b603251267682ab47bb6a8ba574efbe27f5dae6b2df43f9f03addb4239927edea5ff9b1573
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class DataListConverter
|
2
2
|
def self.save_to_file(filename, data, data_format=:item_data, options={})
|
3
3
|
file_format = options.delete(:file_format) || self.get_file_format(filename)
|
4
|
-
options[file_format]
|
4
|
+
options[file_format] ||= {}
|
5
|
+
options[file_format][:filename] = filename
|
5
6
|
DataListConverter.convert(data_format, file_format, data, options)
|
6
7
|
end
|
7
8
|
|
@@ -17,13 +17,15 @@ class DataListConverter
|
|
17
17
|
end
|
18
18
|
|
19
19
|
self.register_converter(:table_iterator, :xlsx_file) do |proc, options|
|
20
|
+
type = options[:type]
|
20
21
|
book = RubyXL::Workbook.new
|
21
22
|
sheet = book.worksheets[0]
|
22
23
|
sheet.sheet_name = options[:sheet] if options[:sheet]
|
23
24
|
i = 0
|
24
25
|
proc.call do |row|
|
25
26
|
row.each_with_index do |v, j|
|
26
|
-
|
27
|
+
v = v.to_s unless type == :raw
|
28
|
+
sheet.add_cell(i, j, v)
|
27
29
|
end
|
28
30
|
i += 1
|
29
31
|
end
|
@@ -33,6 +35,7 @@ class DataListConverter
|
|
33
35
|
end
|
34
36
|
|
35
37
|
self.register_converter(:multi_sheet_table_iterator, :xlsx_file) do |data, options|
|
38
|
+
type = options[:type]
|
36
39
|
book = RubyXL::Workbook.new
|
37
40
|
book.worksheets.pop
|
38
41
|
data.each do |name, table_iterator|
|
@@ -49,7 +52,8 @@ class DataListConverter
|
|
49
52
|
end
|
50
53
|
cell.change_fill(v[:fill_color]) if v[:fill_color]
|
51
54
|
else
|
52
|
-
|
55
|
+
v = v.to_s unless type == :raw
|
56
|
+
cell = sheet.add_cell(i, j, v)
|
53
57
|
end
|
54
58
|
|
55
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_list_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- linjunhalida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|