rubyfromexcel 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. data/examples/checkpoints/checkpoint/checkpoint0.marshal +0 -0
  2. data/examples/checkpoints/checkpoint/checkpoint1.marshal +0 -0
  3. data/examples/checkpoints/checkpoint/checkpoint2.marshal +0 -0
  4. data/examples/checkpoints/checkpoint/checkpoint3.marshal +0 -0
  5. data/examples/checkpoints/checkpoint/checkpoint4.marshal +0 -0
  6. data/examples/checkpoints/checkpoint/checkpoint5.marshal +0 -0
  7. data/examples/ruby-versions/array-formulas-ruby/sheets/sheet1.rb +59 -0
  8. data/examples/ruby-versions/array-formulas-ruby/sheets/sheet2.rb +9 -0
  9. data/examples/ruby-versions/array-formulas-ruby/specs/sheet1_rspec.rb +156 -0
  10. data/examples/ruby-versions/array-formulas-ruby/specs/sheet2_rspec.rb +8 -0
  11. data/examples/ruby-versions/array-formulas-ruby/spreadsheet.rb +9 -0
  12. data/examples/ruby-versions/checkpoint-ruby/sheets/sheet1.rb +307 -0
  13. data/examples/ruby-versions/checkpoint-ruby/sheets/sheet2.rb +148 -0
  14. data/examples/ruby-versions/checkpoint-ruby/specs/sheet1_rspec.rb +884 -0
  15. data/examples/ruby-versions/checkpoint-ruby/specs/sheet2_rspec.rb +412 -0
  16. data/examples/ruby-versions/checkpoint-ruby/spreadsheet.rb +9 -0
  17. data/examples/ruby-versions/complex-test-ruby/sheets/sheet1.rb +305 -0
  18. data/examples/ruby-versions/complex-test-ruby/sheets/sheet2.rb +147 -0
  19. data/examples/ruby-versions/complex-test-ruby/specs/sheet1_rspec.rb +876 -0
  20. data/examples/ruby-versions/complex-test-ruby/specs/sheet2_rspec.rb +412 -0
  21. data/examples/ruby-versions/complex-test-ruby/spreadsheet.rb +9 -0
  22. data/examples/ruby-versions/namedReferenceTest-ruby/sheets/sheet1.rb +9 -0
  23. data/examples/ruby-versions/namedReferenceTest-ruby/sheets/sheet2.rb +8 -0
  24. data/examples/ruby-versions/namedReferenceTest-ruby/specs/sheet1_rspec.rb +16 -0
  25. data/examples/ruby-versions/namedReferenceTest-ruby/specs/sheet2_rspec.rb +16 -0
  26. data/examples/ruby-versions/namedReferenceTest-ruby/spreadsheet.rb +9 -0
  27. data/examples/ruby-versions/pruning-ruby/sheets/sheet1.rb +18 -0
  28. data/examples/ruby-versions/pruning-ruby/sheets/sheet2.rb +16 -0
  29. data/examples/ruby-versions/pruning-ruby/sheets/sheet3.rb +7 -0
  30. data/examples/ruby-versions/pruning-ruby/specs/sheet1_rspec.rb +28 -0
  31. data/examples/ruby-versions/pruning-ruby/specs/sheet2_rspec.rb +28 -0
  32. data/examples/ruby-versions/pruning-ruby/specs/sheet3_rspec.rb +8 -0
  33. data/examples/ruby-versions/pruning-ruby/spreadsheet.rb +9 -0
  34. data/examples/ruby-versions/sharedFormulaTest-ruby/sheets/sheet1.rb +15 -0
  35. data/examples/ruby-versions/sharedFormulaTest-ruby/specs/sheet1_rspec.rb +44 -0
  36. data/examples/ruby-versions/sharedFormulaTest-ruby/spreadsheet.rb +9 -0
  37. data/examples/ruby-versions/table-test-ruby/sheets/sheet1.rb +17 -0
  38. data/examples/ruby-versions/table-test-ruby/sheets/sheet2.rb +5 -0
  39. data/examples/ruby-versions/table-test-ruby/sheets/sheet3.rb +5 -0
  40. data/examples/ruby-versions/table-test-ruby/specs/sheet1_rspec.rb +20 -0
  41. data/examples/ruby-versions/table-test-ruby/specs/sheet2_rspec.rb +8 -0
  42. data/examples/ruby-versions/table-test-ruby/specs/sheet3_rspec.rb +8 -0
  43. data/examples/ruby-versions/table-test-ruby/spreadsheet.rb +9 -0
  44. data/examples/sheets/2050Model.xlsx +0 -0
  45. data/examples/unzipped-sheets/array-formulas/[Content_Types].xml +2 -0
  46. data/examples/unzipped-sheets/array-formulas/docProps/app.xml +2 -0
  47. data/examples/unzipped-sheets/array-formulas/docProps/core.xml +2 -0
  48. data/examples/unzipped-sheets/array-formulas/docProps/thumbnail.jpeg +0 -0
  49. data/examples/unzipped-sheets/array-formulas/xl/_rels/workbook.xml.rels +2 -0
  50. data/examples/unzipped-sheets/array-formulas/xl/calcChain.xml +2 -0
  51. data/examples/unzipped-sheets/array-formulas/xl/sharedStrings.xml +2 -0
  52. data/examples/unzipped-sheets/array-formulas/xl/styles.xml +2 -0
  53. data/examples/unzipped-sheets/array-formulas/xl/theme/theme1.xml +2 -0
  54. data/examples/unzipped-sheets/array-formulas/xl/workbook.xml +2 -0
  55. data/examples/unzipped-sheets/array-formulas/xl/worksheets/sheet1.xml +2 -0
  56. data/examples/unzipped-sheets/array-formulas/xl/worksheets/sheet2.xml +2 -0
  57. data/examples/unzipped-sheets/checkpoint/[Content_Types].xml +2 -0
  58. data/examples/unzipped-sheets/checkpoint/docProps/app.xml +2 -0
  59. data/examples/unzipped-sheets/checkpoint/docProps/core.xml +2 -0
  60. data/examples/unzipped-sheets/checkpoint/xl/_rels/workbook.xml.rels +2 -0
  61. data/examples/unzipped-sheets/checkpoint/xl/calcChain.xml +2 -0
  62. data/examples/unzipped-sheets/checkpoint/xl/charts/chart1.xml +2 -0
  63. data/examples/unzipped-sheets/checkpoint/xl/charts/chart2.xml +2 -0
  64. data/examples/unzipped-sheets/checkpoint/xl/comments1.xml +5 -0
  65. data/examples/unzipped-sheets/checkpoint/xl/comments2.xml +5 -0
  66. data/examples/unzipped-sheets/checkpoint/xl/drawings/_rels/drawing1.xml.rels +2 -0
  67. data/examples/unzipped-sheets/checkpoint/xl/drawings/_rels/drawing2.xml.rels +2 -0
  68. data/examples/unzipped-sheets/checkpoint/xl/drawings/drawing1.xml +2 -0
  69. data/examples/unzipped-sheets/checkpoint/xl/drawings/drawing2.xml +2 -0
  70. data/examples/unzipped-sheets/checkpoint/xl/drawings/vmlDrawing1.vml +47 -0
  71. data/examples/unzipped-sheets/checkpoint/xl/drawings/vmlDrawing2.vml +47 -0
  72. data/examples/unzipped-sheets/checkpoint/xl/sharedStrings.xml +2 -0
  73. data/examples/unzipped-sheets/checkpoint/xl/styles.xml +2 -0
  74. data/examples/unzipped-sheets/checkpoint/xl/theme/theme1.xml +2 -0
  75. data/examples/unzipped-sheets/checkpoint/xl/workbook.xml +2 -0
  76. data/examples/unzipped-sheets/checkpoint/xl/worksheets/_rels/sheet1.xml.rels +2 -0
  77. data/examples/unzipped-sheets/checkpoint/xl/worksheets/_rels/sheet2.xml.rels +2 -0
  78. data/examples/unzipped-sheets/checkpoint/xl/worksheets/sheet1.xml +2 -0
  79. data/examples/unzipped-sheets/checkpoint/xl/worksheets/sheet2.xml +2 -0
  80. data/examples/unzipped-sheets/complex-test/[Content_Types].xml +2 -0
  81. data/examples/unzipped-sheets/complex-test/docProps/app.xml +2 -0
  82. data/examples/unzipped-sheets/complex-test/docProps/core.xml +2 -0
  83. data/examples/unzipped-sheets/complex-test/xl/_rels/workbook.xml.rels +2 -0
  84. data/examples/unzipped-sheets/complex-test/xl/calcChain.xml +2 -0
  85. data/examples/unzipped-sheets/complex-test/xl/charts/chart1.xml +2 -0
  86. data/examples/unzipped-sheets/complex-test/xl/charts/chart2.xml +2 -0
  87. data/examples/unzipped-sheets/complex-test/xl/comments1.xml +5 -0
  88. data/examples/unzipped-sheets/complex-test/xl/comments2.xml +5 -0
  89. data/examples/unzipped-sheets/complex-test/xl/drawings/_rels/drawing1.xml.rels +2 -0
  90. data/examples/unzipped-sheets/complex-test/xl/drawings/_rels/drawing2.xml.rels +2 -0
  91. data/examples/unzipped-sheets/complex-test/xl/drawings/drawing1.xml +2 -0
  92. data/examples/unzipped-sheets/complex-test/xl/drawings/drawing2.xml +2 -0
  93. data/examples/unzipped-sheets/complex-test/xl/drawings/vmlDrawing1.vml +46 -0
  94. data/examples/unzipped-sheets/complex-test/xl/drawings/vmlDrawing2.vml +46 -0
  95. data/examples/unzipped-sheets/complex-test/xl/sharedStrings.xml +2 -0
  96. data/examples/unzipped-sheets/complex-test/xl/styles.xml +2 -0
  97. data/examples/unzipped-sheets/complex-test/xl/theme/theme1.xml +2 -0
  98. data/examples/unzipped-sheets/complex-test/xl/workbook.xml +2 -0
  99. data/examples/unzipped-sheets/complex-test/xl/worksheets/_rels/sheet1.xml.rels +2 -0
  100. data/examples/unzipped-sheets/complex-test/xl/worksheets/_rels/sheet2.xml.rels +2 -0
  101. data/examples/unzipped-sheets/complex-test/xl/worksheets/sheet1.xml +2 -0
  102. data/examples/unzipped-sheets/complex-test/xl/worksheets/sheet2.xml +2 -0
  103. data/examples/unzipped-sheets/complex-test/xl/worksheets/sheet3.xml +2 -0
  104. data/examples/unzipped-sheets/namedReferenceTest/[Content_Types].xml +2 -0
  105. data/examples/unzipped-sheets/namedReferenceTest/docProps/app.xml +2 -0
  106. data/examples/unzipped-sheets/namedReferenceTest/docProps/core.xml +2 -0
  107. data/examples/unzipped-sheets/namedReferenceTest/docProps/thumbnail.jpeg +0 -0
  108. data/examples/unzipped-sheets/namedReferenceTest/xl/_rels/workbook.xml.rels +2 -0
  109. data/examples/unzipped-sheets/namedReferenceTest/xl/calcChain.xml +2 -0
  110. data/examples/unzipped-sheets/namedReferenceTest/xl/styles.xml +2 -0
  111. data/examples/unzipped-sheets/namedReferenceTest/xl/theme/theme1.xml +2 -0
  112. data/examples/unzipped-sheets/namedReferenceTest/xl/workbook.xml +2 -0
  113. data/examples/unzipped-sheets/namedReferenceTest/xl/worksheets/sheet1.xml +2 -0
  114. data/examples/unzipped-sheets/namedReferenceTest/xl/worksheets/sheet2.xml +2 -0
  115. data/examples/unzipped-sheets/pruning/[Content_Types].xml +2 -0
  116. data/examples/unzipped-sheets/pruning/docProps/app.xml +2 -0
  117. data/examples/unzipped-sheets/pruning/docProps/core.xml +2 -0
  118. data/examples/unzipped-sheets/pruning/docProps/thumbnail.jpeg +0 -0
  119. data/examples/unzipped-sheets/pruning/xl/_rels/workbook.xml.rels +2 -0
  120. data/examples/unzipped-sheets/pruning/xl/calcChain.xml +2 -0
  121. data/examples/unzipped-sheets/pruning/xl/sharedStrings.xml +2 -0
  122. data/examples/unzipped-sheets/pruning/xl/styles.xml +2 -0
  123. data/examples/unzipped-sheets/pruning/xl/tables/table1.xml +2 -0
  124. data/examples/unzipped-sheets/pruning/xl/theme/theme1.xml +2 -0
  125. data/examples/unzipped-sheets/pruning/xl/workbook.xml +2 -0
  126. data/examples/unzipped-sheets/pruning/xl/worksheets/_rels/sheet2.xml.rels +2 -0
  127. data/examples/unzipped-sheets/pruning/xl/worksheets/sheet1.xml +2 -0
  128. data/examples/unzipped-sheets/pruning/xl/worksheets/sheet2.xml +2 -0
  129. data/examples/unzipped-sheets/pruning/xl/worksheets/sheet3.xml +2 -0
  130. data/examples/unzipped-sheets/sharedFormulaTest/[Content_Types].xml +2 -0
  131. data/examples/unzipped-sheets/sharedFormulaTest/docProps/app.xml +2 -0
  132. data/examples/unzipped-sheets/sharedFormulaTest/docProps/core.xml +2 -0
  133. data/examples/unzipped-sheets/sharedFormulaTest/docProps/thumbnail.jpeg +0 -0
  134. data/examples/unzipped-sheets/sharedFormulaTest/xl/_rels/workbook.xml.rels +2 -0
  135. data/examples/unzipped-sheets/sharedFormulaTest/xl/calcChain.xml +2 -0
  136. data/examples/unzipped-sheets/sharedFormulaTest/xl/styles.xml +2 -0
  137. data/examples/unzipped-sheets/sharedFormulaTest/xl/theme/theme1.xml +2 -0
  138. data/examples/unzipped-sheets/sharedFormulaTest/xl/workbook.xml +2 -0
  139. data/examples/unzipped-sheets/sharedFormulaTest/xl/worksheets/sheet1.xml +2 -0
  140. data/examples/unzipped-sheets/table-test/[Content_Types].xml +2 -0
  141. data/examples/unzipped-sheets/table-test/docProps/app.xml +2 -0
  142. data/examples/unzipped-sheets/table-test/docProps/core.xml +2 -0
  143. data/examples/unzipped-sheets/table-test/xl/_rels/workbook.xml.rels +2 -0
  144. data/examples/unzipped-sheets/table-test/xl/calcChain.xml +2 -0
  145. data/examples/unzipped-sheets/table-test/xl/printerSettings/printerSettings1.bin +0 -0
  146. data/examples/unzipped-sheets/table-test/xl/sharedStrings.xml +2 -0
  147. data/examples/unzipped-sheets/table-test/xl/styles.xml +2 -0
  148. data/examples/unzipped-sheets/table-test/xl/tables/table1.xml +2 -0
  149. data/examples/unzipped-sheets/table-test/xl/theme/theme1.xml +2 -0
  150. data/examples/unzipped-sheets/table-test/xl/workbook.xml +2 -0
  151. data/examples/unzipped-sheets/table-test/xl/worksheets/_rels/sheet1.xml.rels +2 -0
  152. data/examples/unzipped-sheets/table-test/xl/worksheets/sheet1.xml +2 -0
  153. data/examples/unzipped-sheets/table-test/xl/worksheets/sheet2.xml +2 -0
  154. data/examples/unzipped-sheets/table-test/xl/worksheets/sheet3.xml +2 -0
  155. data/lib/formulae/compile/formula_builder.rb +1 -0
  156. data/lib/formulae/parse/formula_peg.rb +3 -3
  157. data/lib/formulae/parse/formula_peg.txt +3 -3
  158. data/lib/formulae/run/excel_functions.rb +10 -3
  159. data/spec/excel_functions_spec.rb +21 -0
  160. data/spec/formula_peg_spec.rb +3 -0
  161. metadata +156 -3
@@ -0,0 +1,412 @@
1
+ # coding: utf-8
2
+ require_relative '../spreadsheet'
3
+ # OLD UK
4
+ describe 'Sheet2' do
5
+ def sheet2; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet2; end
6
+
7
+ it 'cell d5 should equal 160.40945' do
8
+ sheet2.d5.should be_within(16.040945).of(160.40945)
9
+ end
10
+
11
+ it 'cell e5 should equal 157.61832557' do
12
+ sheet2.e5.should be_within(15.761832557).of(157.61832557)
13
+ end
14
+
15
+ it 'cell f5 should equal 154.87576670508201' do
16
+ sheet2.f5.should be_within(15.487576670508203).of(154.87576670508201)
17
+ end
18
+
19
+ it 'cell g5 should equal 152.1809283644136' do
20
+ sheet2.g5.should be_within(15.218092836441361).of(152.1809283644136)
21
+ end
22
+
23
+ it 'cell h5 should equal 149.5329802108728' do
24
+ sheet2.h5.should be_within(14.953298021087281).of(149.5329802108728)
25
+ end
26
+
27
+ it 'cell i5 should equal 146.93110635520364' do
28
+ sheet2.i5.should be_within(14.693110635520364).of(146.93110635520364)
29
+ end
30
+
31
+ it 'cell j5 should equal 144.3745051046231' do
32
+ sheet2.j5.should be_within(14.43745051046231).of(144.3745051046231)
33
+ end
34
+
35
+ it 'cell c6 should equal 134.16697500000004' do
36
+ sheet2.c6.should be_within(13.416697500000005).of(134.16697500000004)
37
+ end
38
+
39
+ it 'cell d6 should equal 131.83246963500005' do
40
+ sheet2.d6.should be_within(13.183246963500006).of(131.83246963500005)
41
+ end
42
+
43
+ it 'cell e6 should equal 129.53858466335103' do
44
+ sheet2.e6.should be_within(12.953858466335104).of(129.53858466335103)
45
+ end
46
+
47
+ it 'cell f6 should equal 127.28461329020871' do
48
+ sheet2.f6.should be_within(12.728461329020872).of(127.28461329020871)
49
+ end
50
+
51
+ it 'cell g6 should equal 125.06986101895905' do
52
+ sheet2.g6.should be_within(12.506986101895905).of(125.06986101895905)
53
+ end
54
+
55
+ it 'cell h6 should equal 122.89364543722914' do
56
+ sheet2.h6.should be_within(12.289364543722915).of(122.89364543722914)
57
+ end
58
+
59
+ it 'cell i6 should equal 120.75529600662136' do
60
+ sheet2.i6.should be_within(12.075529600662136).of(120.75529600662136)
61
+ end
62
+
63
+ it 'cell j6 should equal 118.65415385610618' do
64
+ sheet2.j6.should be_within(11.865415385610618).of(118.65415385610618)
65
+ end
66
+
67
+ it 'cell l6 should equal 0.017400000000000082' do
68
+ sheet2.l6.should be_within(0.0017400000000000083).of(0.017400000000000082)
69
+ end
70
+
71
+ it 'cell c7 should equal 297.41697500000004' do
72
+ sheet2.c7.should be_within(29.741697500000004).of(297.41697500000004)
73
+ end
74
+
75
+ it 'cell d7 should equal 292.24191963500004' do
76
+ sheet2.d7.should be_within(29.224191963500004).of(292.24191963500004)
77
+ end
78
+
79
+ it 'cell e7 should equal 287.156910233351' do
80
+ sheet2.e7.should be_within(28.715691023335104).of(287.156910233351)
81
+ end
82
+
83
+ it 'cell f7 should equal 282.1603799952907' do
84
+ sheet2.f7.should be_within(28.216037999529075).of(282.1603799952907)
85
+ end
86
+
87
+ it 'cell g7 should equal 277.25078938337265' do
88
+ sheet2.g7.should be_within(27.725078938337266).of(277.25078938337265)
89
+ end
90
+
91
+ it 'cell h7 should equal 272.42662564810195' do
92
+ sheet2.h7.should be_within(27.242662564810196).of(272.42662564810195)
93
+ end
94
+
95
+ it 'cell i7 should equal 267.686402361825' do
96
+ sheet2.i7.should be_within(26.768640236182502).of(267.686402361825)
97
+ end
98
+
99
+ it 'cell j7 should equal 263.0286589607293' do
100
+ sheet2.j7.should be_within(26.30286589607293).of(263.0286589607293)
101
+ end
102
+
103
+ it 'cell c9 should equal 2013.0' do
104
+ sheet2.c9.should be_within(201.3).of(2013.0)
105
+ end
106
+
107
+ it 'cell d9 should equal 2014.0' do
108
+ sheet2.d9.should be_within(201.4).of(2014.0)
109
+ end
110
+
111
+ it 'cell e9 should equal 2015.0' do
112
+ sheet2.e9.should be_within(201.5).of(2015.0)
113
+ end
114
+
115
+ it 'cell f9 should equal 2016.0' do
116
+ sheet2.f9.should be_within(201.60000000000002).of(2016.0)
117
+ end
118
+
119
+ it 'cell g9 should equal 2017.0' do
120
+ sheet2.g9.should be_within(201.70000000000002).of(2017.0)
121
+ end
122
+
123
+ it 'cell h9 should equal 2018.0' do
124
+ sheet2.h9.should be_within(201.8).of(2018.0)
125
+ end
126
+
127
+ it 'cell i9 should equal 2019.0' do
128
+ sheet2.i9.should be_within(201.9).of(2019.0)
129
+ end
130
+
131
+ it 'cell j9 should equal 2020.0' do
132
+ sheet2.j9.should be_within(202.0).of(2020.0)
133
+ end
134
+
135
+ it 'cell d10 should equal 1.0' do
136
+ sheet2.d10.should be_within(0.1).of(1.0)
137
+ end
138
+
139
+ it 'cell e10 should equal 1.0' do
140
+ sheet2.e10.should be_within(0.1).of(1.0)
141
+ end
142
+
143
+ it 'cell f10 should equal 1.0' do
144
+ sheet2.f10.should be_within(0.1).of(1.0)
145
+ end
146
+
147
+ it 'cell g10 should equal 1.0' do
148
+ sheet2.g10.should be_within(0.1).of(1.0)
149
+ end
150
+
151
+ it 'cell h10 should equal 1.0' do
152
+ sheet2.h10.should be_within(0.1).of(1.0)
153
+ end
154
+
155
+ it 'cell i10 should equal 1.0' do
156
+ sheet2.i10.should be_within(0.1).of(1.0)
157
+ end
158
+
159
+ it 'cell j10 should equal 1.0' do
160
+ sheet2.j10.should be_within(0.1).of(1.0)
161
+ end
162
+
163
+ it 'cell d11 should equal 0.3142857142857143' do
164
+ sheet2.d11.should be_within(0.03142857142857143).of(0.3142857142857143)
165
+ end
166
+
167
+ it 'cell e11 should equal 0.4285714285714286' do
168
+ sheet2.e11.should be_within(0.042857142857142864).of(0.4285714285714286)
169
+ end
170
+
171
+ it 'cell f11 should equal 0.5428571428571429' do
172
+ sheet2.f11.should be_within(0.0542857142857143).of(0.5428571428571429)
173
+ end
174
+
175
+ it 'cell g11 should equal 0.6571428571428573' do
176
+ sheet2.g11.should be_within(0.06571428571428573).of(0.6571428571428573)
177
+ end
178
+
179
+ it 'cell h11 should equal 0.7714285714285716' do
180
+ sheet2.h11.should be_within(0.07714285714285717).of(0.7714285714285716)
181
+ end
182
+
183
+ it 'cell i11 should equal 0.8857142857142859' do
184
+ sheet2.i11.should be_within(0.08857142857142859).of(0.8857142857142859)
185
+ end
186
+
187
+ it 'cell l11 should equal 0.1142857142857143' do
188
+ sheet2.l11.should be_within(0.01142857142857143).of(0.1142857142857143)
189
+ end
190
+
191
+ it 'cell c12 should equal 0.6391141426947805' do
192
+ sheet2.c12.should be_within(0.06391141426947805).of(0.6391141426947805)
193
+ end
194
+
195
+ it 'cell d12 should equal 0.6906692651669547' do
196
+ sheet2.d12.should be_within(0.06906692651669548).of(0.6906692651669547)
197
+ end
198
+
199
+ it 'cell e12 should equal 0.742224387639129' do
200
+ sheet2.e12.should be_within(0.0742224387639129).of(0.742224387639129)
201
+ end
202
+
203
+ it 'cell f12 should equal 0.7937795101113032' do
204
+ sheet2.f12.should be_within(0.07937795101113032).of(0.7937795101113032)
205
+ end
206
+
207
+ it 'cell g12 should equal 0.8453346325834775' do
208
+ sheet2.g12.should be_within(0.08453346325834776).of(0.8453346325834775)
209
+ end
210
+
211
+ it 'cell h12 should equal 0.8968897550556517' do
212
+ sheet2.h12.should be_within(0.08968897550556518).of(0.8968897550556517)
213
+ end
214
+
215
+ it 'cell i12 should equal 0.9484448775278258' do
216
+ sheet2.i12.should be_within(0.09484448775278259).of(0.9484448775278258)
217
+ end
218
+
219
+ it 'cell j12 should equal 1.0' do
220
+ sheet2.j12.should be_within(0.1).of(1.0)
221
+ end
222
+
223
+ it 'cell c14 should equal 2013.0' do
224
+ sheet2.c14.should be_within(201.3).of(2013.0)
225
+ end
226
+
227
+ it 'cell d14 should equal 2014.0' do
228
+ sheet2.d14.should be_within(201.4).of(2014.0)
229
+ end
230
+
231
+ it 'cell e14 should equal 2015.0' do
232
+ sheet2.e14.should be_within(201.5).of(2015.0)
233
+ end
234
+
235
+ it 'cell f14 should equal 2016.0' do
236
+ sheet2.f14.should be_within(201.60000000000002).of(2016.0)
237
+ end
238
+
239
+ it 'cell g14 should equal 2017.0' do
240
+ sheet2.g14.should be_within(201.70000000000002).of(2017.0)
241
+ end
242
+
243
+ it 'cell h14 should equal 2018.0' do
244
+ sheet2.h14.should be_within(201.8).of(2018.0)
245
+ end
246
+
247
+ it 'cell i14 should equal 2019.0' do
248
+ sheet2.i14.should be_within(201.9).of(2019.0)
249
+ end
250
+
251
+ it 'cell j14 should equal 2020.0' do
252
+ sheet2.j14.should be_within(202.0).of(2020.0)
253
+ end
254
+
255
+ it 'cell d15 should equal 20.0' do
256
+ sheet2.d15.should be_within(2.0).of(20.0)
257
+ end
258
+
259
+ it 'cell e15 should equal 20.0' do
260
+ sheet2.e15.should be_within(2.0).of(20.0)
261
+ end
262
+
263
+ it 'cell f15 should equal 20.0' do
264
+ sheet2.f15.should be_within(2.0).of(20.0)
265
+ end
266
+
267
+ it 'cell g15 should equal 20.0' do
268
+ sheet2.g15.should be_within(2.0).of(20.0)
269
+ end
270
+
271
+ it 'cell h15 should equal 20.0' do
272
+ sheet2.h15.should be_within(2.0).of(20.0)
273
+ end
274
+
275
+ it 'cell i15 should equal 20.0' do
276
+ sheet2.i15.should be_within(2.0).of(20.0)
277
+ end
278
+
279
+ it 'cell j15 should equal 20.0' do
280
+ sheet2.j15.should be_within(2.0).of(20.0)
281
+ end
282
+
283
+ it 'cell c17 should equal 2013.0' do
284
+ sheet2.c17.should be_within(201.3).of(2013.0)
285
+ end
286
+
287
+ it 'cell d17 should equal 2014.0' do
288
+ sheet2.d17.should be_within(201.4).of(2014.0)
289
+ end
290
+
291
+ it 'cell e17 should equal 2015.0' do
292
+ sheet2.e17.should be_within(201.5).of(2015.0)
293
+ end
294
+
295
+ it 'cell f17 should equal 2016.0' do
296
+ sheet2.f17.should be_within(201.60000000000002).of(2016.0)
297
+ end
298
+
299
+ it 'cell g17 should equal 2017.0' do
300
+ sheet2.g17.should be_within(201.70000000000002).of(2017.0)
301
+ end
302
+
303
+ it 'cell h17 should equal 2018.0' do
304
+ sheet2.h17.should be_within(201.8).of(2018.0)
305
+ end
306
+
307
+ it 'cell i17 should equal 2019.0' do
308
+ sheet2.i17.should be_within(201.9).of(2019.0)
309
+ end
310
+
311
+ it 'cell j17 should equal 2020.0' do
312
+ sheet2.j17.should be_within(202.0).of(2020.0)
313
+ end
314
+
315
+ it 'cell c18 should equal 3.265' do
316
+ sheet2.c18.should be_within(0.3265).of(3.265)
317
+ end
318
+
319
+ it 'cell d18 should equal 3.208189' do
320
+ sheet2.d18.should be_within(0.3208189).of(3.208189)
321
+ end
322
+
323
+ it 'cell e18 should equal 3.1523665114' do
324
+ sheet2.e18.should be_within(0.31523665114).of(3.1523665114)
325
+ end
326
+
327
+ it 'cell f18 should equal 3.09751533410164' do
328
+ sheet2.f18.should be_within(0.30975153341016404).of(3.09751533410164)
329
+ end
330
+
331
+ it 'cell g18 should equal 3.043618567288272' do
332
+ sheet2.g18.should be_within(0.3043618567288272).of(3.043618567288272)
333
+ end
334
+
335
+ it 'cell h18 should equal 2.990659604217456' do
336
+ sheet2.h18.should be_within(0.2990659604217456).of(2.990659604217456)
337
+ end
338
+
339
+ it 'cell i18 should equal 2.9386221271040727' do
340
+ sheet2.i18.should be_within(0.2938622127104073).of(2.9386221271040727)
341
+ end
342
+
343
+ it 'cell j18 should equal 2.8874901020924617' do
344
+ sheet2.j18.should be_within(0.2887490102092462).of(2.8874901020924617)
345
+ end
346
+
347
+ it 'cell c19 should equal 0.5366679000000002' do
348
+ sheet2.c19.should be_within(0.05366679000000002).of(0.5366679000000002)
349
+ end
350
+
351
+ it 'cell d19 should equal 0.8286612377057146' do
352
+ sheet2.d19.should be_within(0.08286612377057147).of(0.8286612377057146)
353
+ end
354
+
355
+ it 'cell e19 should equal 1.110330725685866' do
356
+ sheet2.e19.should be_within(0.11103307256858662).of(1.110330725685866)
357
+ end
358
+
359
+ it 'cell f19 should equal 1.3819472300079803' do
360
+ sheet2.f19.should be_within(0.13819472300079802).of(1.3819472300079803)
361
+ end
362
+
363
+ it 'cell g19 should equal 1.6437753162491764' do
364
+ sheet2.g19.should be_within(0.16437753162491764).of(1.6437753162491764)
365
+ end
366
+
367
+ it 'cell h19 should equal 1.8960733867458215' do
368
+ sheet2.h19.should be_within(0.18960733867458215).of(1.8960733867458215)
369
+ end
370
+
371
+ it 'cell i19 should equal 2.1390938149744363' do
372
+ sheet2.i19.should be_within(0.21390938149744365).of(2.1390938149744363)
373
+ end
374
+
375
+ it 'cell j19 should equal 2.3730830771221236' do
376
+ sheet2.j19.should be_within(0.23730830771221237).of(2.3730830771221236)
377
+ end
378
+
379
+ it 'cell c20 should equal 3.8016679' do
380
+ sheet2.c20.should be_within(0.38016679000000003).of(3.8016679)
381
+ end
382
+
383
+ it 'cell d20 should equal 4.036850237705714' do
384
+ sheet2.d20.should be_within(0.4036850237705714).of(4.036850237705714)
385
+ end
386
+
387
+ it 'cell e20 should equal 4.262697237085867' do
388
+ sheet2.e20.should be_within(0.4262697237085867).of(4.262697237085867)
389
+ end
390
+
391
+ it 'cell f20 should equal 4.479462564109621' do
392
+ sheet2.f20.should be_within(0.44794625641096214).of(4.479462564109621)
393
+ end
394
+
395
+ it 'cell g20 should equal 4.687393883537449' do
396
+ sheet2.g20.should be_within(0.4687393883537449).of(4.687393883537449)
397
+ end
398
+
399
+ it 'cell h20 should equal 4.886732990963277' do
400
+ sheet2.h20.should be_within(0.48867329909632773).of(4.886732990963277)
401
+ end
402
+
403
+ it 'cell i20 should equal 5.077715942078508' do
404
+ sheet2.i20.should be_within(0.5077715942078508).of(5.077715942078508)
405
+ end
406
+
407
+ it 'cell j20 should equal 5.260573179214585' do
408
+ sheet2.j20.should be_within(0.5260573179214586).of(5.260573179214585)
409
+ end
410
+
411
+ end
412
+
@@ -0,0 +1,9 @@
1
+ # coding: utf-8
2
+ require 'rubyfromexcel'
3
+
4
+ class Spreadsheet
5
+ include RubyFromExcel::ExcelFunctions
6
+
7
+ end
8
+
9
+ Dir[File.join(File.dirname(__FILE__),"sheets/","sheet*.rb")].each {|f| Spreadsheet.autoload(File.basename(f,".rb").capitalize,f)}
@@ -0,0 +1,9 @@
1
+ # coding: utf-8
2
+ # Sheet1
3
+ class Sheet1 < Spreadsheet
4
+ def a2; 1.0; end
5
+ def a3; 2.0; end
6
+ def a4; @a4 ||= sheet1.a2; end
7
+ def a5; @a5 ||= sheet1.a3; end
8
+ end
9
+
@@ -0,0 +1,8 @@
1
+ # coding: utf-8
2
+ # Sheet1 (2)
3
+ class Sheet2 < Spreadsheet
4
+ def a1; 5.0; end
5
+ def a2; @a2 ||= sheet2.a1; end
6
+ def a3; @a3 ||= sum(sheet1.a('a2','a3')); end
7
+ end
8
+
@@ -0,0 +1,16 @@
1
+ # coding: utf-8
2
+ require_relative '../spreadsheet'
3
+ # Sheet1
4
+ describe 'Sheet1' do
5
+ def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
6
+
7
+ it 'cell a4 should equal 1.0' do
8
+ sheet1.a4.should be_within(0.1).of(1.0)
9
+ end
10
+
11
+ it 'cell a5 should equal 2.0' do
12
+ sheet1.a5.should be_within(0.2).of(2.0)
13
+ end
14
+
15
+ end
16
+