oxcelix 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc8d01b25184b000706d39756bd51d3c9e3ec1a7
4
- data.tar.gz: e2734e36b73b827eac8b02fcea6b5ada9bbb107d
3
+ metadata.gz: b99db0578e523cdacaeebc304bf13850f46c0294
4
+ data.tar.gz: e288d38ee68505029830d3e5b9983ddf19b5f995
5
5
  SHA512:
6
- metadata.gz: 42f5f436cef1f56467be844faf5c91a2ae0a6120fb8cbd30f39fbc982457ba2032fd6f9ad36c16ce29474242e1fd54b55351431c02044a68f8eb7fb77fa85076
7
- data.tar.gz: 6794a8eaf191520bd2545faa5c76c08481fea840aa8a3de7bf39b7a56361bf32d32638da3159c10ac44fe5d5930aae95e5c3b76cfb0a463afaf36a487e54d34a
6
+ metadata.gz: d1a32e742704a9f458465b7c2d7309537c397c3a2624ead2f50f6405cb17590c481f403f3b7752c4607fffb47a5a642dedd3e420927b0a0040df69cc373a106e
7
+ data.tar.gz: f2df2be85463b332b02cfb42144794b25a4385a1ea30a7326f0b2fb6e272eeecec844e60bead634721daf722b5f2cf2f1345f5ec2d80eb1d2fad13d07b330512
data/CHANGES CHANGED
@@ -1,3 +1,11 @@
1
+ 0.4.1
2
+ * Depends on ox >= 2.1.7 that fixed a GC issue on ruby 2.2 (mindreframer)
3
+ * Simplified gemfile (mindreframer)
4
+ * pry in spec_helper (mindreframer)
5
+ * code style cleanup (mindreframer)
6
+ * "duplicate key" warning removed in numformats.rb (mindreframer, jdevega)
7
+ * numformat 49 is now treated as Text (jaydorsey)
8
+
1
9
  0.4.0
2
10
  * Code refactoring - Workbook creation is now more fine-grained.
3
11
  * Speedups: case statements replaced some complex and reoccurring
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Oxcelix
2
2
  =======
3
- <a href="http://badge.fury.io/rb/oxcelix"><img src="https://badge.fury.io/rb/oxcelix@2x.png" alt="Gem Version" height="18"></a>
3
+ <a href="http://badge.fury.io/rb/oxcelix"><img src="https://badge.fury.io/rb/oxcelix.svg" alt="Gem Version" height="18"></a>
4
4
  [![Build Status](https://travis-ci.org/gbiczo/oxcelix.svg?branch=0.4.0)](https://travis-ci.org/gbiczo/oxcelix)
5
5
 
6
6
  Oxcelix - A fast and simple .xlsx file parser
@@ -1,172 +1,172 @@
1
1
  module Oxcelix
2
- module Numformats
3
- # Formatarray is the array of default format strings in Excel. Nil values should apparently contain CJK date format strings,
4
- #feel free to add/document those according to existing standards.
5
- Formatarray = [
6
- {:id => '0', :xl => 'General', :ostring => nil, :cls => 'string'},
7
- {:id => '1', :xl => '0', :ostring => '%1d', :cls => 'numeric'},
8
- {:id => '2', :xl => '0.00', :ostring => '%1.2f', :cls => 'numeric'},
9
- {:id => '3', :xl => '#,##0', :ostring => '%#4d', :cls => 'numeric'},
10
- {:id => '4', :xl => '#,##0.00', :ostring => '%#4.2f', :cls => 'numeric'},
11
- {:id => '5', :xl => '', :ostring => nil, :cls => 'string'},
12
- {:id => '6', :xl => '', :ostring => nil, :cls => 'string'},
13
- {:id => '7', :xl => '', :ostring => nil, :cls => 'string'},
14
- {:id => '8', :xl => '', :ostring => nil, :cls => 'string'},
15
- {:id => '9', :xl => '0%', :ostring => '%1d%', :cls => 'numeric'},
16
- {:id => '10', :xl => '0.00%', :ostring => '%1.2f%', :cls => 'numeric'},
17
- {:id => '11', :xl => '0.00E+00', :ostring => '%1.2fE+', :cls => 'numeric'},
18
- {:id => '12', :xl => '# ?/?', :ostring => '%#1d', :cls => 'rational'},
19
- {:id => '13', :xl => '# ??/??', :ostring => '%#1d', :cls => 'rational'},
20
- {:id => '14', :xl => 'd/m/yyyy', :ostring => '%-d/%-m/%Y', :cls => 'date'},
21
- {:id => '15', :xl => 'd-mmm-yy', :ostring => '%-d-%b-%y', :cls => 'date'},
22
- {:id => '16', :xl => 'd-mmm', :ostring => '%-d-%b', :cls => 'date'},
23
- {:id => '17', :xl => 'mmm-yy', :ostring => '%b-%y', :cls => 'date'},
24
- {:id => '18', :xl => 'h:mm tt', :ostring => '%-k:%M tt', :cls => 'date'},
25
- {:id => '19', :xl => 'h:mm:ss tt', :ostring => '%-k:%M:%-S tt', :cls => 'date'},
26
- {:id => '20', :xl => 'H:mm', :ostring => '%-k:%M', :cls => 'date'},
27
- {:id => '21', :xl => 'H:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
28
- {:id => '22', :xl => 'm/d/yyyy H:mm', :ostring => '%-m/%-d/%Y %-k:%M', :cls => 'date'},
29
- {:id => '23', :xl => '', :ostring => nil, :cls => 'string'},
30
- {:id => '24', :xl => '', :ostring => nil, :cls => 'string'},
31
- {:id => '25', :xl => '', :ostring => nil, :cls => 'string'},
32
- {:id => '26', :xl => '', :ostring => nil, :cls => 'string'},
33
- {:id => '27', :xl => '', :ostring => nil, :cls => 'string'},
34
- {:id => '28', :xl => '', :ostring => nil, :cls => 'string'},
35
- {:id => '29', :xl => '', :ostring => nil, :cls => 'string'},
36
- {:id => '30', :xl => '', :ostring => nil, :cls => 'string'},
37
- {:id => '31', :xl => '', :ostring => nil, :cls => 'string'},
38
- {:id => '32', :xl => '', :ostring => nil, :cls => 'string'},
39
- {:id => '33', :xl => '', :ostring => nil, :cls => 'string'},
40
- {:id => '34', :xl => '', :ostring => nil, :cls => 'string'},
41
- {:id => '35', :xl => '', :ostring => nil, :cls => 'string'},
42
- {:id => '36', :xl => '', :ostring => nil, :cls => 'string'},
43
- {:id => '37', :xl => '#,##0 ;(#,##0)', :ostring => '%#4d', :cls => 'numeric'},
44
- {:id => '38', :xl => '#,##0 ;[Red](#,##0)', :ostring => '%#4d', :cls => 'numeric'},
45
- {:id => '39', :xl => '#,##0.00;(#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
46
- {:id => '40', :xl => '#,##0.00;[Red](#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
47
- {:id => '41', :xl => '', :ostring => nil, :cls => 'string'},
48
- {:id => '42', :xl => '', :ostring => nil, :cls => 'string'},
49
- {:id => '43', :xl => '', :ostring => nil, :cls => 'string'},
50
- {:id => '44', :xl => '', :ostring => nil, :cls => 'string'},
51
- {:id => '45', :xl => 'mm:ss', :ostring => '%M:%-S', :cls => 'date'},
52
- {:id => '46', :xl => '[h]:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
53
- {:id => '47', :xl => 'mmss.0', :ostring => '%M%-S.%1n', :cls => 'date'},
54
- {:id => '48', :xl => '##0.0E+0', :ostring => '%#3.1E', :cls => 'numeric'},
55
- {:id => '49', :xl => '@,', :ostring => '@%d', :cls => 'numeric'},
56
- {:id => '50', :xl => '', :ostring => nil, :cls => 'string'},
57
- {:id => '51', :xl => '', :ostring => nil, :cls => 'string'},
58
- {:id => '52', :xl => '', :ostring => nil, :cls => 'string'},
59
- {:id => '53', :xl => '', :ostring => nil, :cls => 'string'},
60
- {:id => '54', :xl => '', :ostring => nil, :cls => 'string'},
61
- {:id => '55', :xl => '', :ostring => nil, :cls => 'string'},
62
- {:id => '56', :xl => '', :ostring => nil, :cls => 'string'},
63
- {:id => '57', :xl => '', :ostring => nil, :cls => 'string'},
64
- {:id => '58', :xl => '', :ostring => nil, :cls => 'string'},
65
- {:id => '59', :xl => '', :ostring => nil, :cls => 'string'},
66
- {:id => '60', :xl => '', :ostring => nil, :cls => 'string'},
67
- {:id => '61', :xl => '', :ostring => nil, :cls => 'string'},
68
- {:id => '62', :xl => '', :ostring => nil, :cls => 'string'},
69
- {:id => '63', :xl => '', :ostring => nil, :cls => 'string'},
70
- {:id => '64', :xl => '', :ostring => nil, :cls => 'string'},
71
- {:id => '65', :xl => '', :ostring => nil, :cls => 'string'},
72
- {:id => '66', :xl => '', :ostring => nil, :cls => 'string'},
73
- {:id => '67', :xl => '', :ostring => nil, :cls => 'string'},
74
- {:id => '68', :xl => '', :ostring => nil, :cls => 'string'},
75
- {:id => '69', :xl => '', :ostring => nil, :cls => 'string'},
76
- {:id => '70', :xl => '', :ostring => nil, :cls => 'string'},
77
- {:id => '71', :xl => '', :ostring => nil, :cls => 'string'},
78
- {:id => '72', :xl => '', :ostring => nil, :cls => 'string'},
79
- {:id => '73', :xl => '', :ostring => nil, :cls => 'string'},
80
- {:id => '74', :xl => '', :ostring => nil, :cls => 'string'},
81
- {:id => '75', :xl => '', :ostring => nil, :cls => 'string'},
82
- {:id => '76', :xl => '', :ostring => nil, :cls => 'string'},
83
- {:id => '77', :xl => '', :ostring => nil, :cls => 'string'},
84
- {:id => '78', :xl => '', :ostring => nil, :cls => 'string'},
85
- {:id => '79', :xl => '', :ostring => nil, :cls => 'string'},
86
- {:id => '80', :xl => '', :ostring => nil, :cls => 'string'},
87
- {:id => '81', :xl => '', :ostring => nil, :cls => 'string'},
88
- {:id => '82', :xl => '', :ostring => nil, :cls => 'string'},
89
- {:id => '83', :xl => '', :ostring => nil, :cls => 'string'},
90
- {:id => '84', :xl => '', :ostring => nil, :cls => 'string'},
91
- {:id => '85', :xl => '', :ostring => nil, :cls => 'string'},
92
- {:id => '86', :xl => '', :ostring => nil, :cls => 'string'},
93
- {:id => '87', :xl => '', :ostring => nil, :cls => 'string'},
94
- {:id => '88', :xl => '', :ostring => nil, :cls => 'string'},
95
- {:id => '89', :xl => '', :ostring => nil, :cls => 'string'},
96
- {:id => '90', :xl => '', :ostring => nil, :cls => 'string'},
97
- {:id => '91', :xl => '', :ostring => nil, :cls => 'string'},
98
- {:id => '92', :xl => '', :ostring => nil, :cls => 'string'},
99
- {:id => '93', :xl => '', :ostring => nil, :cls => 'string'},
100
- {:id => '94', :xl => '', :ostring => nil, :cls => 'string'},
101
- {:id => '95', :xl => '', :ostring => nil, :cls => 'string'},
102
- {:id => '96', :xl => '', :ostring => nil, :cls => 'string'},
103
- {:id => '97', :xl => '', :ostring => nil, :cls => 'string'},
104
- {:id => '98', :xl => '', :ostring => nil, :cls => 'string'},
105
- {:id => '99', :xl => '', :ostring => nil, :cls => 'string'},
106
- {:id => '100', :xl => '', :ostring => nil, :cls => 'string'},
107
- {:id => '101', :xl => '', :ostring => nil, :cls => 'string'},
108
- {:id => '102', :xl => '', :ostring => nil, :cls => 'string'},
109
- {:id => '103', :xl => '', :ostring => nil, :cls => 'string'},
110
- {:id => '104', :xl => '', :ostring => nil, :cls => 'string'},
111
- {:id => '105', :xl => '', :ostring => nil, :cls => 'string'},
112
- {:id => '106', :xl => '', :ostring => nil, :cls => 'string'},
113
- {:id => '107', :xl => '', :ostring => nil, :cls => 'string'},
114
- {:id => '108', :xl => '', :ostring => nil, :cls => 'string'},
115
- {:id => '109', :xl => '', :ostring => nil, :cls => 'string'},
116
- {:id => '110', :xl => '', :ostring => nil, :cls => 'string'},
117
- {:id => '111', :xl => '', :ostring => nil, :cls => 'string'},
118
- {:id => '112', :xl => '', :ostring => nil, :cls => 'string'},
119
- {:id => '113', :xl => '', :ostring => nil, :cls => 'string'},
120
- {:id => '114', :xl => '', :ostring => nil, :cls => 'string'},
121
- {:id => '115', :xl => '', :ostring => nil, :cls => 'string'},
122
- {:id => '116', :xl => '', :ostring => nil, :cls => 'string'},
123
- {:id => '117', :xl => '', :ostring => nil, :cls => 'string'},
124
- {:id => '118', :xl => '', :ostring => nil, :cls => 'string'},
125
- {:id => '119', :xl => '', :ostring => nil, :cls => 'string'},
126
- {:id => '120', :xl => '', :ostring => nil, :cls => 'string'},
127
- {:id => '121', :xl => '', :ostring => nil, :cls => 'string'},
128
- {:id => '122', :xl => '', :ostring => nil, :cls => 'string'},
129
- {:id => '123', :xl => '', :ostring => nil, :cls => 'string'},
130
- {:id => '124', :xl => '', :ostring => nil, :cls => 'string'},
131
- {:id => '125', :xl => '', :ostring => nil, :cls => 'string'},
132
- {:id => '126', :xl => '', :ostring => nil, :cls => 'string'},
133
- {:id => '127', :xl => '', :ostring => nil, :cls => 'string'},
134
- {:id => '128', :xl => '', :ostring => nil, :cls => 'string'},
135
- {:id => '129', :xl => '', :ostring => nil, :cls => 'string'},
136
- {:id => '130', :xl => '', :ostring => nil, :cls => 'string'},
137
- {:id => '131', :xl => '', :ostring => nil, :cls => 'string'},
138
- {:id => '132', :xl => '', :ostring => nil, :cls => 'string'},
139
- {:id => '133', :xl => '', :ostring => nil, :cls => 'string'},
140
- {:id => '134', :xl => '', :ostring => nil, :cls => 'string'},
141
- {:id => '135', :xl => '', :ostring => nil, :cls => 'string'},
142
- {:id => '136', :xl => '', :ostring => nil, :cls => 'string'},
143
- {:id => '137', :xl => '', :ostring => nil, :cls => 'string'},
144
- {:id => '138', :xl => '', :ostring => nil, :cls => 'string'},
145
- {:id => '139', :xl => '', :ostring => nil, :cls => 'string'},
146
- {:id => '140', :xl => '', :ostring => nil, :cls => 'string'},
147
- {:id => '141', :xl => '', :ostring => nil, :cls => 'string'},
148
- {:id => '142', :xl => '', :ostring => nil, :cls => 'string'},
149
- {:id => '143', :xl => '', :ostring => nil, :cls => 'string'},
150
- {:id => '144', :xl => '', :ostring => nil, :cls => 'string'},
151
- {:id => '145', :xl => '', :ostring => nil, :cls => 'string'},
152
- {:id => '146', :xl => '', :ostring => nil, :cls => 'string'},
153
- {:id => '147', :xl => '', :ostring => nil, :cls => 'string'},
154
- {:id => '148', :xl => '', :ostring => nil, :cls => 'string'},
155
- {:id => '149', :xl => '', :ostring => nil, :cls => 'string'},
156
- {:id => '150', :xl => '', :ostring => nil, :cls => 'string'},
157
- {:id => '151', :xl => '', :ostring => nil, :cls => 'string'},
158
- {:id => '152', :xl => '', :ostring => nil, :cls => 'string'},
159
- {:id => '153', :xl => '', :ostring => nil, :cls => 'string'},
160
- {:id => '154', :xl => '', :ostring => nil, :cls => 'string'},
161
- {:id => '155', :xl => '', :ostring => nil, :cls => 'string'},
162
- {:id => '156', :xl => '', :ostring => nil, :cls => 'string'},
163
- {:id => '157', :xl => '', :ostring => nil, :cls => 'string'},
164
- {:id => '158', :xl => '', :ostring => nil, :cls => 'string'},
165
- {:id => '159', :xl => '', :ostring => nil, :cls => 'string'},
166
- {:id => '160', :xl => '', :ostring => nil, :cls => 'string'},
167
- {:id => '161', :xl => '', :ostring => nil, :cls => 'string'},
168
- {:id => '162', :xl => '', :ostring => nil, :cls => 'string'},
169
- {:id => '163', :xl => '', :ostring => nil, :cls => 'string'},
170
- ]
2
+ module Numformats
3
+ # Formatarray is the array of default format strings in Excel. Nil values should apparently contain CJK date format strings,
4
+ #feel free to add/document those according to existing standards.
5
+ Formatarray = [
6
+ {:id => '0', :xl => 'General', :ostring => nil, :cls => 'string'},
7
+ {:id => '1', :xl => '0', :ostring => '%1d', :cls => 'numeric'},
8
+ {:id => '2', :xl => '0.00', :ostring => '%1.2f', :cls => 'numeric'},
9
+ {:id => '3', :xl => '#,##0', :ostring => '%#4d', :cls => 'numeric'},
10
+ {:id => '4', :xl => '#,##0.00', :ostring => '%#4.2f', :cls => 'numeric'},
11
+ {:id => '5', :xl => '', :ostring => nil, :cls => 'string'},
12
+ {:id => '6', :xl => '', :ostring => nil, :cls => 'string'},
13
+ {:id => '7', :xl => '', :ostring => nil, :cls => 'string'},
14
+ {:id => '8', :xl => '', :ostring => nil, :cls => 'string'},
15
+ {:id => '9', :xl => '0%', :ostring => '%1d%', :cls => 'numeric'},
16
+ {:id => '10', :xl => '0.00%', :ostring => '%1.2f%', :cls => 'numeric'},
17
+ {:id => '11', :xl => '0.00E+00', :ostring => '%1.2fE+', :cls => 'numeric'},
18
+ {:id => '12', :xl => '# ?/?', :ostring => '%#1d', :cls => 'rational'},
19
+ {:id => '13', :xl => '# ??/??', :ostring => '%#1d', :cls => 'rational'},
20
+ {:id => '14', :xl => 'd/m/yyyy', :ostring => '%-d/%-m/%Y', :cls => 'date'},
21
+ {:id => '15', :xl => 'd-mmm-yy', :ostring => '%-d-%b-%y', :cls => 'date'},
22
+ {:id => '16', :xl => 'd-mmm', :ostring => '%-d-%b', :cls => 'date'},
23
+ {:id => '17', :xl => 'mmm-yy', :ostring => '%b-%y', :cls => 'date'},
24
+ {:id => '18', :xl => 'h:mm tt', :ostring => '%-k:%M tt', :cls => 'date'},
25
+ {:id => '19', :xl => 'h:mm:ss tt', :ostring => '%-k:%M:%-S tt', :cls => 'date'},
26
+ {:id => '20', :xl => 'H:mm', :ostring => '%-k:%M', :cls => 'date'},
27
+ {:id => '21', :xl => 'H:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
28
+ {:id => '22', :xl => 'm/d/yyyy H:mm', :ostring => '%-m/%-d/%Y %-k:%M', :cls => 'date'},
29
+ {:id => '23', :xl => '', :ostring => nil, :cls => 'string'},
30
+ {:id => '24', :xl => '', :ostring => nil, :cls => 'string'},
31
+ {:id => '25', :xl => '', :ostring => nil, :cls => 'string'},
32
+ {:id => '26', :xl => '', :ostring => nil, :cls => 'string'},
33
+ {:id => '27', :xl => '', :ostring => nil, :cls => 'string'},
34
+ {:id => '28', :xl => '', :ostring => nil, :cls => 'string'},
35
+ {:id => '29', :xl => '', :ostring => nil, :cls => 'string'},
36
+ {:id => '30', :xl => '', :ostring => nil, :cls => 'string'},
37
+ {:id => '31', :xl => '', :ostring => nil, :cls => 'string'},
38
+ {:id => '32', :xl => '', :ostring => nil, :cls => 'string'},
39
+ {:id => '33', :xl => '', :ostring => nil, :cls => 'string'},
40
+ {:id => '34', :xl => '', :ostring => nil, :cls => 'string'},
41
+ {:id => '35', :xl => '', :ostring => nil, :cls => 'string'},
42
+ {:id => '36', :xl => '', :ostring => nil, :cls => 'string'},
43
+ {:id => '37', :xl => '#,##0 ;(#,##0)', :ostring => '%#4d', :cls => 'numeric'},
44
+ {:id => '38', :xl => '#,##0 ;[Red](#,##0)', :ostring => '%#4d', :cls => 'numeric'},
45
+ {:id => '39', :xl => '#,##0.00;(#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
46
+ {:id => '40', :xl => '#,##0.00;[Red](#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
47
+ {:id => '41', :xl => '', :ostring => nil, :cls => 'string'},
48
+ {:id => '42', :xl => '', :ostring => nil, :cls => 'string'},
49
+ {:id => '43', :xl => '', :ostring => nil, :cls => 'string'},
50
+ {:id => '44', :xl => '', :ostring => nil, :cls => 'string'},
51
+ {:id => '45', :xl => 'mm:ss', :ostring => '%M:%-S', :cls => 'date'},
52
+ {:id => '46', :xl => '[h]:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
53
+ {:id => '47', :xl => 'mmss.0', :ostring => '%M%-S.%1n', :cls => 'date'},
54
+ {:id => '48', :xl => '##0.0E+0', :ostring => '%#3.1E', :cls => 'numeric'},
55
+ {:id => '49', :xl => 'Text', :ostring => nil, :cls => 'string'},
56
+ {:id => '50', :xl => '', :ostring => nil, :cls => 'string'},
57
+ {:id => '51', :xl => '', :ostring => nil, :cls => 'string'},
58
+ {:id => '52', :xl => '', :ostring => nil, :cls => 'string'},
59
+ {:id => '53', :xl => '', :ostring => nil, :cls => 'string'},
60
+ {:id => '54', :xl => '', :ostring => nil, :cls => 'string'},
61
+ {:id => '55', :xl => '', :ostring => nil, :cls => 'string'},
62
+ {:id => '56', :xl => '', :ostring => nil, :cls => 'string'},
63
+ {:id => '57', :xl => '', :ostring => nil, :cls => 'string'},
64
+ {:id => '58', :xl => '', :ostring => nil, :cls => 'string'},
65
+ {:id => '59', :xl => '', :ostring => nil, :cls => 'string'},
66
+ {:id => '60', :xl => '', :ostring => nil, :cls => 'string'},
67
+ {:id => '61', :xl => '', :ostring => nil, :cls => 'string'},
68
+ {:id => '62', :xl => '', :ostring => nil, :cls => 'string'},
69
+ {:id => '63', :xl => '', :ostring => nil, :cls => 'string'},
70
+ {:id => '64', :xl => '', :ostring => nil, :cls => 'string'},
71
+ {:id => '65', :xl => '', :ostring => nil, :cls => 'string'},
72
+ {:id => '66', :xl => '', :ostring => nil, :cls => 'string'},
73
+ {:id => '67', :xl => '', :ostring => nil, :cls => 'string'},
74
+ {:id => '68', :xl => '', :ostring => nil, :cls => 'string'},
75
+ {:id => '69', :xl => '', :ostring => nil, :cls => 'string'},
76
+ {:id => '70', :xl => '', :ostring => nil, :cls => 'string'},
77
+ {:id => '71', :xl => '', :ostring => nil, :cls => 'string'},
78
+ {:id => '72', :xl => '', :ostring => nil, :cls => 'string'},
79
+ {:id => '73', :xl => '', :ostring => nil, :cls => 'string'},
80
+ {:id => '74', :xl => '', :ostring => nil, :cls => 'string'},
81
+ {:id => '75', :xl => '', :ostring => nil, :cls => 'string'},
82
+ {:id => '76', :xl => '', :ostring => nil, :cls => 'string'},
83
+ {:id => '77', :xl => '', :ostring => nil, :cls => 'string'},
84
+ {:id => '78', :xl => '', :ostring => nil, :cls => 'string'},
85
+ {:id => '79', :xl => '', :ostring => nil, :cls => 'string'},
86
+ {:id => '80', :xl => '', :ostring => nil, :cls => 'string'},
87
+ {:id => '81', :xl => '', :ostring => nil, :cls => 'string'},
88
+ {:id => '82', :xl => '', :ostring => nil, :cls => 'string'},
89
+ {:id => '83', :xl => '', :ostring => nil, :cls => 'string'},
90
+ {:id => '84', :xl => '', :ostring => nil, :cls => 'string'},
91
+ {:id => '85', :xl => '', :ostring => nil, :cls => 'string'},
92
+ {:id => '86', :xl => '', :ostring => nil, :cls => 'string'},
93
+ {:id => '87', :xl => '', :ostring => nil, :cls => 'string'},
94
+ {:id => '88', :xl => '', :ostring => nil, :cls => 'string'},
95
+ {:id => '89', :xl => '', :ostring => nil, :cls => 'string'},
96
+ {:id => '90', :xl => '', :ostring => nil, :cls => 'string'},
97
+ {:id => '91', :xl => '', :ostring => nil, :cls => 'string'},
98
+ {:id => '92', :xl => '', :ostring => nil, :cls => 'string'},
99
+ {:id => '93', :xl => '', :ostring => nil, :cls => 'string'},
100
+ {:id => '94', :xl => '', :ostring => nil, :cls => 'string'},
101
+ {:id => '95', :xl => '', :ostring => nil, :cls => 'string'},
102
+ {:id => '96', :xl => '', :ostring => nil, :cls => 'string'},
103
+ {:id => '97', :xl => '', :ostring => nil, :cls => 'string'},
104
+ {:id => '98', :xl => '', :ostring => nil, :cls => 'string'},
105
+ {:id => '99', :xl => '', :ostring => nil, :cls => 'string'},
106
+ {:id => '100', :xl => '', :ostring => nil, :cls => 'string'},
107
+ {:id => '101', :xl => '', :ostring => nil, :cls => 'string'},
108
+ {:id => '102', :xl => '', :ostring => nil, :cls => 'string'},
109
+ {:id => '103', :xl => '', :ostring => nil, :cls => 'string'},
110
+ {:id => '104', :xl => '', :ostring => nil, :cls => 'string'},
111
+ {:id => '105', :xl => '', :ostring => nil, :cls => 'string'},
112
+ {:id => '106', :xl => '', :ostring => nil, :cls => 'string'},
113
+ {:id => '107', :xl => '', :ostring => nil, :cls => 'string'},
114
+ {:id => '108', :xl => '', :ostring => nil, :cls => 'string'},
115
+ {:id => '109', :xl => '', :ostring => nil, :cls => 'string'},
116
+ {:id => '110', :xl => '', :ostring => nil, :cls => 'string'},
117
+ {:id => '111', :xl => '', :ostring => nil, :cls => 'string'},
118
+ {:id => '112', :xl => '', :ostring => nil, :cls => 'string'},
119
+ {:id => '113', :xl => '', :ostring => nil, :cls => 'string'},
120
+ {:id => '114', :xl => '', :ostring => nil, :cls => 'string'},
121
+ {:id => '115', :xl => '', :ostring => nil, :cls => 'string'},
122
+ {:id => '116', :xl => '', :ostring => nil, :cls => 'string'},
123
+ {:id => '117', :xl => '', :ostring => nil, :cls => 'string'},
124
+ {:id => '118', :xl => '', :ostring => nil, :cls => 'string'},
125
+ {:id => '119', :xl => '', :ostring => nil, :cls => 'string'},
126
+ {:id => '120', :xl => '', :ostring => nil, :cls => 'string'},
127
+ {:id => '121', :xl => '', :ostring => nil, :cls => 'string'},
128
+ {:id => '122', :xl => '', :ostring => nil, :cls => 'string'},
129
+ {:id => '123', :xl => '', :ostring => nil, :cls => 'string'},
130
+ {:id => '124', :xl => '', :ostring => nil, :cls => 'string'},
131
+ {:id => '125', :xl => '', :ostring => nil, :cls => 'string'},
132
+ {:id => '126', :xl => '', :ostring => nil, :cls => 'string'},
133
+ {:id => '127', :xl => '', :ostring => nil, :cls => 'string'},
134
+ {:id => '128', :xl => '', :ostring => nil, :cls => 'string'},
135
+ {:id => '129', :xl => '', :ostring => nil, :cls => 'string'},
136
+ {:id => '130', :xl => '', :ostring => nil, :cls => 'string'},
137
+ {:id => '131', :xl => '', :ostring => nil, :cls => 'string'},
138
+ {:id => '132', :xl => '', :ostring => nil, :cls => 'string'},
139
+ {:id => '133', :xl => '', :ostring => nil, :cls => 'string'},
140
+ {:id => '134', :xl => '', :ostring => nil, :cls => 'string'},
141
+ {:id => '135', :xl => '', :ostring => nil, :cls => 'string'},
142
+ {:id => '136', :xl => '', :ostring => nil, :cls => 'string'},
143
+ {:id => '137', :xl => '', :ostring => nil, :cls => 'string'},
144
+ {:id => '138', :xl => '', :ostring => nil, :cls => 'string'},
145
+ {:id => '139', :xl => '', :ostring => nil, :cls => 'string'},
146
+ {:id => '140', :xl => '', :ostring => nil, :cls => 'string'},
147
+ {:id => '141', :xl => '', :ostring => nil, :cls => 'string'},
148
+ {:id => '142', :xl => '', :ostring => nil, :cls => 'string'},
149
+ {:id => '143', :xl => '', :ostring => nil, :cls => 'string'},
150
+ {:id => '144', :xl => '', :ostring => nil, :cls => 'string'},
151
+ {:id => '145', :xl => '', :ostring => nil, :cls => 'string'},
152
+ {:id => '146', :xl => '', :ostring => nil, :cls => 'string'},
153
+ {:id => '147', :xl => '', :ostring => nil, :cls => 'string'},
154
+ {:id => '148', :xl => '', :ostring => nil, :cls => 'string'},
155
+ {:id => '149', :xl => '', :ostring => nil, :cls => 'string'},
156
+ {:id => '150', :xl => '', :ostring => nil, :cls => 'string'},
157
+ {:id => '151', :xl => '', :ostring => nil, :cls => 'string'},
158
+ {:id => '152', :xl => '', :ostring => nil, :cls => 'string'},
159
+ {:id => '153', :xl => '', :ostring => nil, :cls => 'string'},
160
+ {:id => '154', :xl => '', :ostring => nil, :cls => 'string'},
161
+ {:id => '155', :xl => '', :ostring => nil, :cls => 'string'},
162
+ {:id => '156', :xl => '', :ostring => nil, :cls => 'string'},
163
+ {:id => '157', :xl => '', :ostring => nil, :cls => 'string'},
164
+ {:id => '158', :xl => '', :ostring => nil, :cls => 'string'},
165
+ {:id => '159', :xl => '', :ostring => nil, :cls => 'string'},
166
+ {:id => '160', :xl => '', :ostring => nil, :cls => 'string'},
167
+ {:id => '161', :xl => '', :ostring => nil, :cls => 'string'},
168
+ {:id => '162', :xl => '', :ostring => nil, :cls => 'string'},
169
+ {:id => '163', :xl => '', :ostring => nil, :cls => 'string'},
170
+ ]
171
171
  end
172
172
  end
@@ -6,7 +6,7 @@ module Oxcelix
6
6
  Dtmap = {'hh'=>'%H', 'ii'=>'%M', 'i'=>'%-M', 'H'=>'%-k', 'h'=>'%-k',\
7
7
  'ss'=>'%-S', 's'=>'%S', 'mmmmm'=>'%b', 'mmmm'=>'%B', 'mmm'=>'%b', 'mm'=>'%m', \
8
8
  'm'=>'%-m', 'dddd'=>'%A', 'ddd'=>'%a', 'dd'=>'%d', 'd'=>'%-d', 'yyyy'=>'%Y', \
9
- 'yy'=>'%y', 'AM/PM'=>'%p', 'A/P'=>'%p', '.0'=>'', 'ss'=>'%-S', 's'=>'%S'}
9
+ 'yy'=>'%y', 'AM/PM'=>'%p', 'A/P'=>'%p', '.0'=>''}
10
10
 
11
11
  # Convert the temporary format array (the collection of non-default number formatting strings defined in the excel sheet in use)
12
12
  # to a series of hashes containing an id, an excel format string, a converted format string and an object class the format is
@@ -7,21 +7,21 @@ module Oxcelix
7
7
  # @return [Hash] a hash representing a comment
8
8
  attr_accessor :commarray, :comment
9
9
  def initialize
10
- @commarray=[]
11
- @comment={}
10
+ @commarray = []
11
+ @comment = {}
12
12
  end
13
-
13
+
14
14
  # Push Cell comment hash (comment + reference) to @commarray
15
15
  def text(str)
16
- @comment[:comment]=str.gsub('&#10;', '')
16
+ @comment[:comment] = str.gsub('&#10;', '')
17
17
  @commarray << @comment
18
18
  @comment = Hash.new
19
19
  end
20
-
20
+
21
21
  # Returns reference
22
22
  def attr(name, str)
23
23
  if name == :ref
24
- @comment[:ref]=str
24
+ @comment[:ref] = str
25
25
  end
26
26
  end
27
27
  end
@@ -1,12 +1,12 @@
1
1
  module Oxcelix
2
- # Ox based SAX parser which pushes shared strings (taken from the sharedString.xml file) to an array
3
- # These strings will replace the references in the cells (interpolation).
2
+ # Ox based SAX parser which pushes shared strings (taken from the sharedString.xml file) to an array
3
+ # These strings will replace the references in the cells (interpolation).
4
4
  class Sharedstrings < ::Ox::Sax
5
5
  # @!attribute [rw] stringarray
6
6
  # @return [Array] the array of all the strings found in sharedStrings.xml
7
7
  attr_accessor :stringarray
8
8
  def initialize
9
- @stringarray=[]
9
+ @stringarray = []
10
10
  end
11
11
 
12
12
  # Push the comment string into @stringarray
@@ -1,17 +1,17 @@
1
1
  require 'ox'
2
2
  module Oxcelix
3
3
 
4
- # Ox based SAX parser which pushes the number formats (taken from the styles.xml file) to an array
4
+ # Ox based SAX parser which pushes the number formats (taken from the styles.xml file) to an array
5
5
  # The reference taken from the cell's 's' attribute points to an element of the
6
6
  # style array, which in turn points to a number format (numFmt) that can be
7
7
  # either built-in (@formats) or defined in the styles.xml itself.
8
8
  class Styles < ::Ox::Sax
9
9
  attr_accessor :styleary, :xmlstack, :temparray
10
10
  def initialize
11
- @temparray=[]
12
- @styleary=[]
13
- @xmlstack = []
14
- @numform={}
11
+ @temparray = []
12
+ @styleary = []
13
+ @xmlstack = []
14
+ @numform = {}
15
15
  end
16
16
 
17
17
  def nf key, value
@@ -33,7 +33,7 @@ module Oxcelix
33
33
  def formatCode str
34
34
  nf :formatCode, str
35
35
  end
36
-
36
+
37
37
  def start_element(name)
38
38
  @xmlstack << name
39
39
  end
@@ -46,4 +46,4 @@ module Oxcelix
46
46
  self.send name, str if self.respond_to?(name)
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -22,10 +22,10 @@ module Oxcelix
22
22
  # @return [Cell] the cell currently being processed.
23
23
  attr_accessor :xmlstack, :mergedcells, :cellarray, :cell
24
24
  def initialize()
25
- @xmlstack = []
25
+ @xmlstack = []
26
26
  @mergedcells = []
27
- @cellarray = []
28
- @cell = Cell.new
27
+ @cellarray = []
28
+ @cell = Cell.new
29
29
  end
30
30
 
31
31
  # Save SAX state-machine state to {#xmlstack} if and only if the processed
@@ -39,19 +39,19 @@ module Oxcelix
39
39
  @xmlstack << name
40
40
  end
41
41
  end
42
-
42
+
43
43
  # Step back in the stack ({#xmlstack}.pop), clear actual cell information
44
44
  # @param [String] name Element ends
45
45
  def end_element(name)
46
46
  @xmlstack.pop
47
47
  case name
48
48
  when :c
49
- @cell=Cell.new
49
+ @cell = Cell.new
50
50
  when :mergeCell
51
- @cell=Cell.new
51
+ @cell = Cell.new
52
52
  end
53
53
  end
54
-
54
+
55
55
  # Set cell value, style, etc. This will only happen if the cell has an
56
56
  # actual value AND the parser's state is :c.
57
57
  # If the state is :mergeCell AND the actual attribute name is :ref the
@@ -59,7 +59,7 @@ module Oxcelix
59
59
  # The attribute name is tested against the Cell object: if the cell
60
60
  # has a method named the same way, that method is called with the str parameter.
61
61
  # @param [String] name of the attribute.
62
- # @param [String] str Content of the attribute
62
+ # @param [String] str Content of the attribute
63
63
  def attr(name, str)
64
64
  case @xmlstack.last
65
65
  when :c
@@ -78,57 +78,57 @@ module Oxcelix
78
78
  @cell.v str
79
79
  @cellarray << @cell
80
80
  end
81
- @cell=Cell.new
81
+ @cell = Cell.new
82
82
  end
83
83
  end
84
84
  end
85
85
 
86
- # A class that is inherited from the Xlsheet parser, but only parses a "page" of the given sheet.
86
+ # A class that is inherited from the Xlsheet parser, but only parses a "page" of the given sheet.
87
87
  # Its initialize will honor the per_page option (lines per page) and the pageno option (actual page to be parsed)
88
- # Cells outside the actual page will be omitted from the parsing process. Mergegroups will only be included
88
+ # Cells outside the actual page will be omitted from the parsing process. Mergegroups will only be included
89
89
  # if the starting cell is within the actual page
90
90
  class PagSheet < Xlsheet
91
91
  attr_accessor :xmlstack, :mergedcells, :cellarray, :cell
92
-
92
+
93
93
  def initialize(per_page, pageno)
94
- @PER_PAGE=per_page
95
- @PAGENO=pageno
94
+ @PER_PAGE = per_page
95
+ @PAGENO = pageno
96
96
  super()
97
97
  end
98
-
98
+
99
99
  def text(str)
100
100
  if @xmlstack.last == :c
101
101
  if @cell.type != "shared" && @cell.type != "e" && str.numeric? && ((@PER_PAGE * (@PAGENO-1)..(@PER_PAGE*@PAGENO-1)).include?@cell.y)
102
102
  @cell.v str
103
103
  @cellarray << @cell
104
104
  end
105
- @cell=Cell.new
105
+ @cell = Cell.new
106
106
  end
107
107
  end
108
108
  end
109
109
 
110
- # A class that is inherited from the Xlsheet parser, but only parses a given range of the given sheet.
110
+ # A class that is inherited from the Xlsheet parser, but only parses a given range of the given sheet.
111
111
  # Its initialize will accept a range parameter. Cells outside this range will not be parsed at all.
112
112
  # Mergegroups will only be included if the starting cell is within the selected range.
113
113
  class Cellrange < Xlsheet
114
114
  attr_accessor :xmlstack, :mergedcells, :cellarray, :cell
115
115
 
116
116
  def initialize(range)
117
- @cell=Cell.new
118
- @RANGE_START=range.begin
119
- @RANGE_END=range.end
117
+ @cell = Cell.new
118
+ @RANGE_START = range.begin
119
+ @RANGE_END = range.end
120
120
  super()
121
121
  end
122
-
122
+
123
123
  def text(str)
124
124
  if @xmlstack.last == :c
125
- if @cell.type != "shared" && @cell.type != "e" && str.numeric?
125
+ if @cell.type != "shared" && @cell.type != "e" && str.numeric?
126
126
  if (((@cell.x(@RANGE_START)..@cell.x(@RANGE_END)).include? @cell.x) && ((@cell.y(@RANGE_START)..@cell.y(@RANGE_END)).include? @cell.y))
127
127
  @cell.v str
128
128
  @cellarray << @cell
129
129
  end
130
130
  end
131
- @cell=Cell.new
131
+ @cell = Cell.new
132
132
  end
133
133
  end
134
134
 
@@ -15,22 +15,22 @@ module Oxcelix
15
15
  # A class that represents an Excel workbook. By default, it will open the excel file, and convert it to a collection of
16
16
  # Matrix objects
17
17
  # @!attribute [rw] sheets
18
- # @return [Array] a collection of {Sheet} objects
18
+ # @return [Array] a collection of {Sheet} objects
19
19
  class Workbook
20
20
  include Cellhelper
21
21
  include Workbookhelper
22
22
  include Numformats
23
-
23
+
24
24
  attr_accessor :sheets
25
25
 
26
26
  ##
27
27
  # Create a new {Workbook} object.
28
28
  #
29
- # filename is the name of the Excel 2007/2010 file (xlsx) to be opened (Optional)
29
+ # filename is the name of the Excel 2007/2010 file (xlsx) to be opened (Optional)
30
30
  #
31
31
  # options is a collection of options that can be passed to Workbook.
32
32
  # Options may include:
33
- # * :copymerge (=> true/false) - Copy and repeat the content of the merged cells into the whole group, e.g.
33
+ # * :copymerge (=> true/false) - Copy and repeat the content of the merged cells into the whole group, e.g.
34
34
  # the group of three merged cells <tt>| a |</tt>
35
35
  # will become: <tt>|a|a|a|</tt>
36
36
  # * :include (Array) - an array of sheet names to be included
@@ -49,7 +49,7 @@ module Oxcelix
49
49
  # * Interpolation of the shared strings
50
50
  # * adding comments to the cells
51
51
  # * Converting each sheet to a Matrix object
52
- # * Deleting the temporary directory that stores the XML files.
52
+ # * Deleting the temporary directory that stores the XML files.
53
53
  def initialize(filename=nil, options={})
54
54
  @sheets=[]
55
55
  @sheetbase={}
@@ -62,17 +62,17 @@ module Oxcelix
62
62
  end
63
63
  end
64
64
 
65
- at_exit do
65
+ at_exit do
66
66
  FileUtils.remove_dir(@destination, true)
67
67
  end
68
-
69
- # Unzips the excel file to a temporary directory. The directory will be removed at the end of the parsing stage when invoked
68
+
69
+ # Unzips the excel file to a temporary directory. The directory will be removed at the end of the parsing stage when invoked
70
70
  # by initialize, otherwise at exit.
71
71
  # @param [String] filename the name of the Excel file to be unpacked
72
72
  def unpack(filename)
73
73
  @destination = Dir.mktmpdir
74
74
  Zip::File.open(filename){ |zip_file|
75
- zip_file.each{ |f|
75
+ zip_file.each{ |f|
76
76
  f_path=File.join(@destination, f.name)
77
77
  FileUtils.mkdir_p(File.dirname(f_path))
78
78
  zip_file.extract(f, f_path) unless File.exists?(f_path)
@@ -85,9 +85,9 @@ module Oxcelix
85
85
  def open(options={})
86
86
  f=IO.read(@destination + '/xl/workbook.xml')
87
87
  a=Ox::load(f)
88
-
88
+
89
89
  sheetdata(a, options); commentsrel; shstrings;
90
-
90
+
91
91
  @styles = Styles.new()
92
92
  File.open(@destination + '/xl/styles.xml', 'r') do |f|
93
93
  Ox.sax_parse(@styles, f)
@@ -134,7 +134,7 @@ module Oxcelix
134
134
  end
135
135
  matrixto options
136
136
  end
137
-
137
+
138
138
  private
139
139
  # @private
140
140
  # Given the data found in workbook.xml, create a hash and push it to the sheets
@@ -174,7 +174,7 @@ module Oxcelix
174
174
  sheetarr=@sheets.map{|i| i[:name]}
175
175
  sheet_collection(sheetarr, options)
176
176
  end
177
-
177
+
178
178
  # Build the array of working sheets based on the :include and :exclude parameters.
179
179
  # @param[sheetarr, options]
180
180
  def sheet_collection(sheetarr, options)
@@ -221,8 +221,8 @@ module Oxcelix
221
221
  end
222
222
  @sharedstrings=strings.stringarray
223
223
  end
224
-
225
- # Parses the comments related to the actual sheet.
224
+
225
+ # Parses the comments related to the actual sheet.
226
226
  # @param [String] commentfile
227
227
  # @return [Array] a collection of comments relative to the Excel sheet currently processed
228
228
  def mkcomments(commentfile)
@@ -247,7 +247,7 @@ module Oxcelix
247
247
  # sheet), and after the only meaningful cell of the minor is found, it is
248
248
  # copied back to the remaining cells of the group. The coordinates (xlcoords)
249
249
  # of each copied cell is changed to reflect the actual Excel coordinate.
250
- #
250
+ #
251
251
  # The matrix will replace the array of cells in the actual sheet.
252
252
  # @param [Hash] options
253
253
  # @return [Matrix] a Matrix object that stores the cell values, and, depending on the copymerge parameter, will copy the merged value
@@ -280,12 +280,12 @@ module Oxcelix
280
280
  end
281
281
  end
282
282
 
283
- # buildsheet creates a matrix of the needed size and fills it with the cells. Mainly for internal use only.
283
+ # buildsheet creates a matrix of the needed size and fills it with the cells. Mainly for internal use only.
284
284
  # When paginating or parsing only a range of cells, the size of the matrix will be adjusted (no nil values
285
285
  # will be left at the beginning of the sheet), to preserve memory.
286
286
  # @param [Sheet] sheet the actual sheetarray.
287
287
  # @param [Hash] options :paginate or :cellrange will affect the size of the matrix
288
- # @return [Sheet] a Sheet object that stores the cell values.
288
+ # @return [Sheet] a Sheet object that stores the cell values.
289
289
  def buildsheet(sheet, options)
290
290
  ydiff, xdiff = 0,0
291
291
  if !options[:paginate].nil?
@@ -294,7 +294,7 @@ module Oxcelix
294
294
  xdiff = x(options[:cellrange].begin)
295
295
  ydiff = y(options[:cellrange].begin)
296
296
  end
297
-
297
+
298
298
  m=Sheet.build(sheet[:cells].last.y+1-ydiff, sheet[:cells].last.x+1-xdiff) {nil}
299
299
  sheet[:cells].each do |c|
300
300
  m[c.y-ydiff, c.x-xdiff] = c
@@ -321,7 +321,7 @@ module Oxcelix
321
321
  end
322
322
  end
323
323
  end
324
-
324
+
325
325
  # RawWorkbook is a Workbook that contains the raw values of the original Excel cells instead of Cell objects.
326
326
  # The values are taken from the Sheet arrays by running the #Cell::value method.
327
327
  class RawWorkbook < Workbook
@@ -3,8 +3,8 @@
3
3
  require 'rake'
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'oxcelix'
6
- s.version = '0.4.0'
7
- s.date = '2014-10-05'
6
+ s.version = '0.4.1'
7
+ s.date = '2015-06-15'
8
8
  s.summary = 'A fast Excel 2007/2010 file parser'
9
9
  s.description = 'A fast Excel 2007/2010 (.xlsx) file parser that returns a collection of Matrix objects'
10
10
  s.authors = 'Giovanni Biczo'
@@ -19,8 +19,12 @@ Gem::Specification.new do |s|
19
19
  "lib/oxcelix/sax/*",
20
20
  "oxcelix.gemspec", "spec/*", ".yardopts", "CHANGES"].to_a
21
21
  s.license = 'MIT'
22
-
23
- s.add_runtime_dependency "ox", [">= 2.0.6"]
22
+
23
+ s.add_runtime_dependency "ox", [">= 2.1.7"]
24
24
  s.add_runtime_dependency "rubyzip", [">= 1.1.0"]
25
+ s.add_development_dependency "pry"
26
+ s.add_development_dependency "rake"
27
+ s.add_development_dependency "rspec"
28
+ s.add_development_dependency "oga"
25
29
  s.rdoc_options << '--all'
26
30
  end
@@ -1,14 +1,13 @@
1
- #require "rspec"
2
- require_relative '../lib/oxcelix.rb'
1
+ require './spec/spec_helper'
3
2
 
4
- describe "Cell" do
3
+ describe "Cell" do
5
4
  describe '#r' do
6
5
  it "sets the value of xlcoords" do
7
6
  c=Oxcelix::Cell.new
8
7
  c.r('H276')
9
- c.xlcoords.should=='H276'
10
- c.x.should==7
11
- c.y.should==275
8
+ c.xlcoords.should == 'H276'
9
+ c.x.should == 7
10
+ c.y.should == 275
12
11
  end
13
12
  end
14
- end
13
+ end
@@ -1,7 +1,6 @@
1
- #require_relative './spec_helper.rb'
2
- require_relative '../lib/oxcelix.rb'
1
+ require './spec/spec_helper'
3
2
 
4
- describe "Fixnum object" do
3
+ describe "Fixnum object" do
5
4
  describe '#col_name' do
6
5
  it "returns a string representing an excel column name" do
7
6
  (0..25).each do |x|
@@ -1,12 +1,11 @@
1
- #require './spec_helper.rb'
2
- require_relative '../lib/oxcelix.rb'
1
+ require './spec/spec_helper'
3
2
 
4
- describe "Matrix object" do
3
+ describe "Matrix object" do
5
4
  describe '#[]=' do
6
5
  it "should set a cell to a new value" do
7
- m_obj=Matrix.build(4, 4){nil}
8
- m_obj[3,3]='foo'
9
- m_obj[3,3].should == 'foo'
10
- end
6
+ m_obj = Matrix.build(4, 4){nil}
7
+ m_obj[3,3] = 'foo'
8
+ m_obj[3,3].should == 'foo'
9
+ end
11
10
  end
12
11
  end
@@ -1,37 +1,31 @@
1
- #require './spec_helper.rb'
2
- require_relative '../lib/oxcelix.rb'
1
+ require './spec/spec_helper.rb'
3
2
 
4
- describe "Oxcelix module" do
5
- # before :all do
6
- describe 'Workbook' do
3
+ describe "Oxcelix module" do
4
+ describe 'Workbook' do
7
5
  context 'normal' do
8
6
  it "should open the excel file and return a Workbook object" do
9
- file = 'spec/test.xlsx'
7
+ file = 'spec/fixtures/test.xlsx'
10
8
  w=Oxcelix::Workbook.new(file)
11
- w.sheets.size.should == 2
12
- w.sheets[0].name.should=="Testsheet1"
13
- w.sheets[1].name.should=="Testsheet2"
9
+ w.sheets.size.should == 2
10
+ w.sheets[0].name.should == "Testsheet1"
11
+ w.sheets[1].name.should == "Testsheet2"
14
12
  end
15
13
  end
16
14
  context 'with excluded sheets' do
17
15
  it "should open the sheets not excluded of the excel file" do
18
- file = 'spec/test.xlsx'
16
+ file = 'spec/fixtures/test.xlsx'
19
17
  w=Oxcelix::Workbook.new(file, {:exclude=>['Testsheet2']})
20
- w.sheets.size.should==1
21
- w.sheets[0].name.should=="Testsheet1"
18
+ w.sheets.size.should == 1
19
+ w.sheets[0].name.should == "Testsheet1"
22
20
  end
23
21
  end
24
22
  context 'with included sheets' do
25
23
  it "should open only the included sheets of the excel file" do
26
- file = 'spec/test.xlsx'
27
- w=Oxcelix::Workbook.new(file, {:include=>['Testsheet2']})
28
- w.sheets.size.should==1
29
- w.sheets[0].name.should=="Testsheet2"
24
+ file = 'spec/fixtures/test.xlsx'
25
+ w = Oxcelix::Workbook.new(file, {:include=>['Testsheet2']})
26
+ w.sheets.size.should == 1
27
+ w.sheets[0].name.should == "Testsheet2"
30
28
  end
31
29
  end
32
- context 'with merged cells copied group-wide'
33
- it "should open the excel file and copy the merged cells trough the mergegroup" do
34
- end
35
- end
36
- # end
30
+ end
37
31
  end
@@ -0,0 +1,13 @@
1
+ require './spec/spec_helper.rb'
2
+
3
+ describe "Oxcelix module" do
4
+ describe 'Sheet' do
5
+ context 'format' do
6
+ it "should not raise a syntax error on a Text field with a ZIP code" do
7
+ file = 'spec/fixtures/test.xlsx'
8
+ w=Oxcelix::Workbook.new(file)
9
+ lambda { w.sheets[0].to_fmt }.should_not raise_error
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,4 @@
1
1
  require_relative '../lib/oxcelix'
2
2
 
3
3
  require 'yaml'
4
+ require 'pry'
@@ -1,19 +1,21 @@
1
- #require './spec_helper.rb'
2
- require_relative '../lib/oxcelix.rb'
3
- describe "String object" do
1
+
2
+ require './spec/spec_helper'
3
+
4
+ describe "String object" do
4
5
  describe 'numeric?' do
5
6
  context "with numbers" do
6
7
  it "should return true" do
7
- (1..100).each do |x|
8
- x.to_s.numeric?.should == true
8
+ (1..100).each do |x|
9
+ x.to_s.numeric?.should == true
10
+ end
9
11
  end
10
12
  end
11
- context "with strings"
12
- it "should return false" do
13
- ('a'..'zz').each do |x|
14
- x.numeric?.should == false
15
- end
16
- end
13
+ context "with strings" do
14
+ it "should return false" do
15
+ ('a'..'zz').each do |x|
16
+ x.numeric?.should == false
17
+ end
18
+ end
17
19
  end
18
20
  end
19
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxcelix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Biczo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-05 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.6
19
+ version: 2.1.7
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: 2.0.6
26
+ version: 2.1.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,62 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: oga
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
41
97
  description: A fast Excel 2007/2010 (.xlsx) file parser that returns a collection
42
98
  of Matrix objects
43
99
  email:
@@ -64,12 +120,11 @@ files:
64
120
  - oxcelix.gemspec
65
121
  - spec/cell_spec.rb
66
122
  - spec/fixnum_spec.rb
67
- - spec/helper.rb
68
123
  - spec/matrix_spec.rb
69
124
  - spec/oxcelix_spec.rb
125
+ - spec/sheet_spec.rb
70
126
  - spec/spec_helper.rb
71
127
  - spec/string_spec.rb
72
- - spec/test.xlsx
73
128
  homepage: http://github.com/gbiczo/oxcelix
74
129
  licenses:
75
130
  - MIT
@@ -91,9 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
146
  version: '0'
92
147
  requirements: []
93
148
  rubyforge_project: oxcelix
94
- rubygems_version: 2.2.1
149
+ rubygems_version: 2.4.8
95
150
  signing_key:
96
151
  specification_version: 4
97
152
  summary: A fast Excel 2007/2010 file parser
98
153
  test_files: []
99
- has_rdoc:
@@ -1,10 +0,0 @@
1
-
2
- testdir = File.dirname(__FILE__)
3
-
4
- $LOAD_PATH.unshift testdir unless $LOAD_PATH.include?(testdir)
5
-
6
- libdir = File.dirname(File.dirname(__FILE__)) + '/lib'
7
-
8
- $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
9
-
10
- require 'oxcelix'
Binary file