rxl 0.4.0 → 0.4.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 +4 -4
- data/lib/cell.rb +15 -17
- data/lib/rxl/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6991fc216795b685c75f3bf7b4222520e428a9b021bac623bc7501e817fd6453
|
4
|
+
data.tar.gz: a99745263d114493fff4802e534f2c97757c7fe75bc6a23726d2a4ad6df7a466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 192009987d16a7b84bd611f62ded016dd230eeb9938eb0e963ba2608ce6414de2821d9669537f340299d1788a67b29cb1c39c3b668b48edb1d09be7af8490086
|
7
|
+
data.tar.gz: 71d91a553075e6af3cc4e8e8729cf45e10afe647dc1049abcefd11898064d04a810f1e2d8aaa1f183b4dcee1c1c2494fca8b77829cc9e496b5e938c95f28678f
|
data/lib/cell.rb
CHANGED
@@ -8,27 +8,26 @@ module Cell
|
|
8
8
|
|
9
9
|
def self.rubyxl_cell_to_hash_cell(rubyxl_cell = nil)
|
10
10
|
rubyxl_cell_value = rubyxl_cell.nil? ? RubyXL::Cell.new.value : rubyxl_cell.value
|
11
|
-
|
11
|
+
{
|
12
12
|
value: rubyxl_cell_value,
|
13
13
|
format: hash_cell_format(rubyxl_cell_value),
|
14
14
|
formula: rubyxl_cell_formula(rubyxl_cell),
|
15
|
-
h_align:
|
16
|
-
v_align:
|
17
|
-
bold: rubyxl_cell.is_bolded,
|
18
|
-
fill: rubyxl_cell.fill_color,
|
19
|
-
font_name: rubyxl_cell.font_name,
|
20
|
-
font_size: rubyxl_cell.font_size.to_i,
|
15
|
+
h_align: rubyxl_cell_h_align(rubyxl_cell),
|
16
|
+
v_align: rubyxl_cell_v_align(rubyxl_cell),
|
17
|
+
bold: rubyxl_cell.nil? ? false : rubyxl_cell.is_bolded,
|
18
|
+
fill: rubyxl_cell.nil? ? 'ffffff' : rubyxl_cell.fill_color,
|
19
|
+
font_name: rubyxl_cell.nil? ? 'Calibri' : rubyxl_cell.font_name,
|
20
|
+
font_size: rubyxl_cell.nil? ? 12 : rubyxl_cell.font_size.to_i,
|
21
21
|
border: rubyxl_cell_to_border_hash(rubyxl_cell)
|
22
22
|
}
|
23
|
-
return values
|
24
23
|
end
|
25
24
|
|
26
25
|
def self.rubyxl_cell_to_border_hash(rubyxl_cell)
|
27
26
|
{
|
28
|
-
top: rubyxl_cell.get_border(:top),
|
29
|
-
bottom: rubyxl_cell.get_border(:bottom),
|
30
|
-
left: rubyxl_cell.get_border(:left),
|
31
|
-
right: rubyxl_cell.get_border(:right)
|
27
|
+
top: rubyxl_cell.nil? ? nil : rubyxl_cell.get_border(:top),
|
28
|
+
bottom: rubyxl_cell.nil? ? nil : rubyxl_cell.get_border(:bottom),
|
29
|
+
left: rubyxl_cell.nil? ? nil : rubyxl_cell.get_border(:left),
|
30
|
+
right: rubyxl_cell.nil? ? nil : rubyxl_cell.get_border(:right)
|
32
31
|
}
|
33
32
|
end
|
34
33
|
|
@@ -37,12 +36,12 @@ module Cell
|
|
37
36
|
rubyxl_cell.formula.expression
|
38
37
|
end
|
39
38
|
|
40
|
-
def self.
|
41
|
-
return
|
39
|
+
def self.rubyxl_cell_h_align(rubyxl_cell)
|
40
|
+
return :left if rubyxl_cell.nil? || rubyxl_cell.horizontal_alignment.nil?
|
42
41
|
rubyxl_cell.horizontal_alignment.to_sym
|
43
42
|
end
|
44
43
|
|
45
|
-
def self.
|
44
|
+
def self.rubyxl_cell_v_align(rubyxl_cell)
|
46
45
|
return :bottom if rubyxl_cell.nil? || rubyxl_cell.vertical_alignment.nil?
|
47
46
|
rubyxl_cell.vertical_alignment.to_sym
|
48
47
|
end
|
@@ -108,8 +107,7 @@ module Cell
|
|
108
107
|
end
|
109
108
|
invalid_keys = hash_cell.keys.delete_if { |key| valid_cell_keys.include?(key) }
|
110
109
|
unless invalid_keys.empty?
|
111
|
-
|
112
|
-
raise(%(invalid cell hash key(s) #{invalid_keys} at path #{trace + [hash_cell_key]}, valid keys are: [#{valid_cell_keys_string}]))
|
110
|
+
raise(%(invalid cell hash key(s) #{invalid_keys} at path #{trace + [hash_cell_key]}))
|
113
111
|
end
|
114
112
|
# TODO: add validation for hash_cell specification
|
115
113
|
end
|
data/lib/rxl/version.rb
CHANGED