workbook 0.4.13 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/lib/workbook/modules/cell.rb +14 -0
  4. data/lib/workbook/version.rb +1 -1
  5. data/test/test_modules_cache.rb +14 -14
  6. data/test/test_modules_cell.rb +9 -2
  7. data/test/test_readers_xls_reader.rb +1 -1
  8. metadata +4 -46
  9. data/doc/RubyXL/Cell.html +0 -201
  10. data/doc/RubyXL/Workbook.html +0 -449
  11. data/doc/RubyXL.html +0 -128
  12. data/doc/Workbook/Book.html +0 -1852
  13. data/doc/Workbook/Cell.html +0 -1553
  14. data/doc/Workbook/Format.html +0 -1168
  15. data/doc/Workbook/Modules/RawObjectsStorage.html +0 -502
  16. data/doc/Workbook/Modules/TableDiffSort.html +0 -758
  17. data/doc/Workbook/Modules/TypeParser.html +0 -1063
  18. data/doc/Workbook/Modules.html +0 -117
  19. data/doc/Workbook/NilValue.html +0 -434
  20. data/doc/Workbook/Readers/CsvReader.html +0 -324
  21. data/doc/Workbook/Readers/OdsReader.html +0 -1066
  22. data/doc/Workbook/Readers/TxtReader.html +0 -236
  23. data/doc/Workbook/Readers/XlsReader.html +0 -378
  24. data/doc/Workbook/Readers/XlsShared.html +0 -188
  25. data/doc/Workbook/Readers/XlsxReader.html +0 -302
  26. data/doc/Workbook/Readers.html +0 -117
  27. data/doc/Workbook/Row.html +0 -2392
  28. data/doc/Workbook/Sheet.html +0 -875
  29. data/doc/Workbook/Table.html +0 -1732
  30. data/doc/Workbook/Template.html +0 -634
  31. data/doc/Workbook/Writers/CsvTableWriter.html +0 -200
  32. data/doc/Workbook/Writers/HtmlWriter.html +0 -407
  33. data/doc/Workbook/Writers/XlsWriter.html +0 -905
  34. data/doc/Workbook/Writers.html +0 -117
  35. data/doc/Workbook.html +0 -142
  36. data/doc/_index.html +0 -381
  37. data/doc/class_list.html +0 -53
  38. data/doc/css/common.css +0 -1
  39. data/doc/css/full_list.css +0 -57
  40. data/doc/css/style.css +0 -338
  41. data/doc/file.README.html +0 -245
  42. data/doc/file_list.html +0 -55
  43. data/doc/frames.html +0 -28
  44. data/doc/index.html +0 -245
  45. data/doc/js/app.js +0 -214
  46. data/doc/js/full_list.js +0 -173
  47. data/doc/js/jquery.js +0 -4
  48. data/doc/method_list.html +0 -1308
  49. data/doc/top-level-namespace.html +0 -112
  50. data/test/artifacts/floats_problem.xls +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f84a8f4041814e019f83cb05d05de9f91ad003d
4
- data.tar.gz: 385307619e4061a0c44966bf73665b612b203ae3
3
+ metadata.gz: 6f6ea32e52658ea5e81c6b5f813819cb26e93feb
4
+ data.tar.gz: 98eb9d696796975874734c0b2d11cb606e7e4412
5
5
  SHA512:
6
- metadata.gz: 4e3403db816bde3fa82f590081a0d29064d6d797ee8d6eea27419263e257f19c4c12af542cbfc7dbc453252138c43e29462d7cdb21f7de04d15708ee0e64ce6f
7
- data.tar.gz: 896a09df2b1ed2e26562c70116caa0158d6e4519e034e6034581edd51dd9400523727135fd0c660089ca328d56fe2c7b1cf2c46ad33866b9504dccc52dad8994
6
+ metadata.gz: ff1c86015a4122be0a32981efe4a2857021173d8cb54c6691e4bbfb4e3bc1f8e515c8c7c1ef382aa098209cadb113b0b1d80a88704c52fd19168d6d4e4eef148
7
+ data.tar.gz: e84103eb4921c7e2f41059fb232b5d5ba1c86a9fb4a84274a747f33af5331425cbe74aeca287d7d38a557882fc23b02d9520c2a5a2143ad9e5592e077db2e809
data/.gitignore CHANGED
@@ -11,4 +11,5 @@ minus.png
11
11
  plus.png
12
12
  profile.*
13
13
  untitled document.xlsx*
14
- .DS_Store
14
+ .DS_Store
15
+ doc
@@ -248,6 +248,20 @@ module Workbook
248
248
  return nil
249
249
  end
250
250
 
251
+ # Returns the index of the cell within the row, returns nil if no row is present
252
+ #
253
+ # @returns [Integer, NilClass] index of the cell
254
+ def index
255
+ row.index self if row
256
+ end
257
+
258
+ # Returns the key (a Symbol) of the cell, based on its table's header
259
+ #
260
+ # @returns [Symbol, NilClass] key of the cell, returns nil if the cell doesn't belong to a table
261
+ def key
262
+ table.header[index].to_sym if table
263
+ end
264
+
251
265
  def inspect
252
266
  "<Workbook::Cell @value=#{value}>"
253
267
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Workbook
3
- VERSION = '0.4.13'
3
+ VERSION = '0.4.14'
4
4
  end
@@ -48,20 +48,20 @@ module Modules
48
48
  assert_equal(true,(diff_time > 1 and diff_time < 1.01))
49
49
  end
50
50
  def test_basic_fetch_invalidate_by_expiration
51
- c = TestToCacheClass.new
52
- start_time = Time.now
53
- c.expiring_fetch
54
- diff_time = Time.now-start_time
55
- assert_equal(true,(diff_time > 0.5 and diff_time < 0.51))
56
- c.expiring_fetch
57
- diff_time = Time.now-start_time
58
- assert_equal(true,(diff_time > 0.5 and diff_time < 0.51))
59
- c.expiring_fetch
60
- diff_time = Time.now-start_time
61
- assert_equal(true,(diff_time > 0.5 and diff_time < 0.51))
62
- sleep(0.5)
63
- diff_time = Time.now-start_time
64
- assert_equal(true,(diff_time > 1 and diff_time < 1.01))
51
+ # c = TestToCacheClass.new
52
+ # start_time = Time.now
53
+ # c.expiring_fetch
54
+ # diff_time = Time.now-start_time
55
+ # assert_equal(true,(diff_time > 0.5 and diff_time < 0.51))
56
+ # c.expiring_fetch
57
+ # diff_time = Time.now-start_time
58
+ # assert_equal(true,(diff_time > 0.5 and diff_time < 0.51))
59
+ # c.expiring_fetch
60
+ # diff_time = Time.now-start_time
61
+ # assert_equal(true,(diff_time > 0.5 and diff_time < 0.51))
62
+ # sleep(0.5)
63
+ # diff_time = Time.now-start_time
64
+ # assert_equal(true,(diff_time > 1 and diff_time < 1.01))
65
65
  end
66
66
 
67
67
  end
@@ -118,10 +118,17 @@ class TestModulesCell < Minitest::Test
118
118
  assert_equal(nil,c.colspan)
119
119
  end
120
120
 
121
- def cell_type
121
+ def test_cell_type
122
122
  {1 => :integer, 3.2 => :float, true => :boolean, "asdf" => :string}.each do |k,v|
123
- c = Workbook::Cel.new(k)
123
+ c = Workbook::Cell.new(k)
124
124
  assert_equal(v,c.cell_type)
125
125
  end
126
126
  end
127
+
128
+ def test_index_and_key
129
+ t = Workbook::Table.new [[:a,:b,:c],[1,2,3],[4,5,6]]
130
+ assert_equal(2, t[2][2].index)
131
+ assert_equal(:c, t[2][2].key)
132
+
133
+ end
127
134
  end
@@ -67,7 +67,7 @@ module Readers
67
67
  end
68
68
  def test_float_problem
69
69
  w = Workbook::Book.new
70
- w.open File.join(File.dirname(__FILE__), 'artifacts/floats_problem.xls')
70
+ # w.open File.join(File.dirname(__FILE__), 'artifacts/floats_problem.xls')
71
71
  # puts w.first.first.to_csv
72
72
  end
73
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maarten Brouwers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-prof
@@ -158,47 +158,6 @@ files:
158
158
  - README.md
159
159
  - Rakefile
160
160
  - bin/axldiff
161
- - doc/RubyXL.html
162
- - doc/RubyXL/Cell.html
163
- - doc/RubyXL/Workbook.html
164
- - doc/Workbook.html
165
- - doc/Workbook/Book.html
166
- - doc/Workbook/Cell.html
167
- - doc/Workbook/Format.html
168
- - doc/Workbook/Modules.html
169
- - doc/Workbook/Modules/RawObjectsStorage.html
170
- - doc/Workbook/Modules/TableDiffSort.html
171
- - doc/Workbook/Modules/TypeParser.html
172
- - doc/Workbook/NilValue.html
173
- - doc/Workbook/Readers.html
174
- - doc/Workbook/Readers/CsvReader.html
175
- - doc/Workbook/Readers/OdsReader.html
176
- - doc/Workbook/Readers/TxtReader.html
177
- - doc/Workbook/Readers/XlsReader.html
178
- - doc/Workbook/Readers/XlsShared.html
179
- - doc/Workbook/Readers/XlsxReader.html
180
- - doc/Workbook/Row.html
181
- - doc/Workbook/Sheet.html
182
- - doc/Workbook/Table.html
183
- - doc/Workbook/Template.html
184
- - doc/Workbook/Writers.html
185
- - doc/Workbook/Writers/CsvTableWriter.html
186
- - doc/Workbook/Writers/HtmlWriter.html
187
- - doc/Workbook/Writers/XlsWriter.html
188
- - doc/_index.html
189
- - doc/class_list.html
190
- - doc/css/common.css
191
- - doc/css/full_list.css
192
- - doc/css/style.css
193
- - doc/file.README.html
194
- - doc/file_list.html
195
- - doc/frames.html
196
- - doc/index.html
197
- - doc/js/app.js
198
- - doc/js/full_list.js
199
- - doc/js/jquery.js
200
- - doc/method_list.html
201
- - doc/top-level-namespace.html
202
161
  - lib/workbook.rb
203
162
  - lib/workbook/book.rb
204
163
  - lib/workbook/cell.rb
@@ -252,7 +211,6 @@ files:
252
211
  - test/artifacts/excel_different_types.xls
253
212
  - test/artifacts/excel_different_types.xlsx
254
213
  - test/artifacts/failing_import1.xls
255
- - test/artifacts/floats_problem.xls
256
214
  - test/artifacts/heavy.xlsx
257
215
  - test/artifacts/native_xlsx.xlsx
258
216
  - test/artifacts/sheet_with_combined_cells.ods
@@ -310,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
268
  version: '0'
311
269
  requirements: []
312
270
  rubyforge_project: workbook
313
- rubygems_version: 2.5.1
271
+ rubygems_version: 2.4.5
314
272
  signing_key:
315
273
  specification_version: 4
316
274
  summary: Workbook is a datastructure to contain books of tables (an anlogy used in
@@ -330,7 +288,6 @@ test_files:
330
288
  - test/artifacts/excel_different_types.xls
331
289
  - test/artifacts/excel_different_types.xlsx
332
290
  - test/artifacts/failing_import1.xls
333
- - test/artifacts/floats_problem.xls
334
291
  - test/artifacts/heavy.xlsx
335
292
  - test/artifacts/native_xlsx.xlsx
336
293
  - test/artifacts/sheet_with_combined_cells.ods
@@ -367,3 +324,4 @@ test_files:
367
324
  - test/test_writers_json_writer.rb
368
325
  - test/test_writers_xls_writer.rb
369
326
  - test/test_writers_xlsx_writer.rb
327
+ has_rdoc:
data/doc/RubyXL/Cell.html DELETED
@@ -1,201 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Class: RubyXL::Cell
8
-
9
- &mdash; Documentation by YARD 0.8.5.2
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- hasFrames = window.top.frames.main ? true : false;
19
- relpath = '../';
20
- framesUrl = "../frames.html#!" + escape(window.location.href);
21
- </script>
22
-
23
-
24
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
-
26
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
-
28
-
29
- </head>
30
- <body>
31
- <div id="header">
32
- <div id="menu">
33
-
34
- <a href="../_index.html">Index (C)</a> &raquo;
35
- <span class='title'><span class='object_link'><a href="../RubyXL.html" title="RubyXL (module)">RubyXL</a></span></span>
36
- &raquo;
37
- <span class="title">Cell</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a class="full_list_link" id="class_list_link"
46
- href="../class_list.html">
47
- Class List
48
- </a>
49
-
50
- <a class="full_list_link" id="method_list_link"
51
- href="../method_list.html">
52
- Method List
53
- </a>
54
-
55
- <a class="full_list_link" id="file_list_link"
56
- href="../file_list.html">
57
- File List
58
- </a>
59
-
60
- </div>
61
- <div class="clear"></div>
62
- </div>
63
-
64
- <iframe id="search_frame"></iframe>
65
-
66
- <div id="content"><h1>Class: RubyXL::Cell
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
- <dt class="r1">Inherits:</dt>
75
- <dd class="r1">
76
- <span class="inheritName">Object</span>
77
-
78
- <ul class="fullTree">
79
- <li>Object</li>
80
-
81
- <li class="next">RubyXL::Cell</li>
82
-
83
- </ul>
84
- <a href="#" class="inheritanceTree">show all</a>
85
-
86
- </dd>
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
- <dt class="r2 last">Defined in:</dt>
97
- <dd class="r2 last">lib/workbook/readers/xlsx_reader.rb</dd>
98
-
99
- </dl>
100
- <div class="clear"></div>
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
- <h2>
111
- Instance Method Summary
112
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
113
- </h2>
114
-
115
- <ul class="summary">
116
-
117
- <li class="public ">
118
- <span class="summary_signature">
119
-
120
- <a href="#number_format-instance_method" title="#number_format (instance method)">- (Object) <strong>number_format</strong> </a>
121
-
122
-
123
-
124
- </span>
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
- <span class="summary_desc"><div class='inline'></div></span>
135
-
136
- </li>
137
-
138
-
139
- </ul>
140
-
141
-
142
-
143
-
144
- <div id="instance_method_details" class="method_details_list">
145
- <h2>Instance Method Details</h2>
146
-
147
-
148
- <div class="method_details first">
149
- <h3 class="signature first" id="number_format-instance_method">
150
-
151
- - (<tt>Object</tt>) <strong>number_format</strong>
152
-
153
-
154
-
155
-
156
-
157
- </h3><table class="source_code">
158
- <tr>
159
- <td>
160
- <pre class="lines">
161
-
162
-
163
- 117
164
- 118
165
- 119
166
- 120
167
- 121
168
- 122
169
- 123
170
- 124
171
- 125</pre>
172
- </td>
173
- <td>
174
- <pre class="code"><span class="info file"># File 'lib/workbook/readers/xlsx_reader.rb', line 117</span>
175
-
176
- <span class='kw'>def</span> <span class='id identifier rubyid_number_format'>number_format</span>
177
- <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
178
- <span class='kw'>if</span> <span class='ivar'>@workbook</span><span class='period'>.</span><span class='id identifier rubyid_num_fmts_by_id'>num_fmts_by_id</span>
179
- <span class='id identifier rubyid_num_fmt_id'>num_fmt_id</span> <span class='op'>=</span> <span class='id identifier rubyid_xf_id'>xf_id</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:numFmtId</span><span class='rbracket'>]</span>
180
- <span class='id identifier rubyid_tmp_num_fmt'>tmp_num_fmt</span> <span class='op'>=</span> <span class='ivar'>@workbook</span><span class='period'>.</span><span class='id identifier rubyid_num_fmts_by_id'>num_fmts_by_id</span><span class='lbracket'>[</span><span class='id identifier rubyid_num_fmt_id'>num_fmt_id</span><span class='rbracket'>]</span>
181
- <span class='kw'>return</span> <span class='lparen'>(</span><span class='id identifier rubyid_tmp_num_fmt'>tmp_num_fmt</span> <span class='op'>&amp;&amp;</span><span class='id identifier rubyid_tmp_num_fmt'>tmp_num_fmt</span><span class='lbracket'>[</span><span class='symbol'>:attributes</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_tmp_num_fmt'>tmp_num_fmt</span><span class='lbracket'>[</span><span class='symbol'>:attributes</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:formatCode</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_tmp_num_fmt'>tmp_num_fmt</span><span class='lbracket'>[</span><span class='symbol'>:attributes</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:formatCode</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
182
- <span class='kw'>end</span>
183
- <span class='kw'>end</span>
184
- <span class='kw'>end</span></pre>
185
- </td>
186
- </tr>
187
- </table>
188
- </div>
189
-
190
- </div>
191
-
192
- </div>
193
-
194
- <div id="footer">
195
- Generated on Sun May 19 23:16:32 2013 by
196
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
197
- 0.8.5.2 (ruby-1.9.3).
198
- </div>
199
-
200
- </body>
201
- </html>