fat_core 1.7.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.org +0 -19
- data/lib/fat_core/string.rb +23 -11
- data/lib/fat_core/version.rb +3 -3
- data/lib/fat_core.rb +0 -4
- data/spec/lib/string_spec.rb +41 -37
- metadata +2 -33
- data/lib/fat_core/column.rb +0 -345
- data/lib/fat_core/evaluator.rb +0 -43
- data/lib/fat_core/formatters/aoa_formatter.rb +0 -84
- data/lib/fat_core/formatters/aoh_formatter.rb +0 -82
- data/lib/fat_core/formatters/formatter.rb +0 -973
- data/lib/fat_core/formatters/org_formatter.rb +0 -72
- data/lib/fat_core/formatters/text_formatter.rb +0 -91
- data/lib/fat_core/formatters.rb +0 -5
- data/lib/fat_core/table.rb +0 -988
- data/spec/example_files/datawatch.org +0 -471
- data/spec/example_files/goldberg.org +0 -199
- data/spec/example_files/wpcs.csv +0 -92
- data/spec/lib/column_spec.rb +0 -224
- data/spec/lib/evaluator_spec.rb +0 -34
- data/spec/lib/formatters/aoa_formatter_spec.rb +0 -62
- data/spec/lib/formatters/aoh_formatter_spec.rb +0 -61
- data/spec/lib/formatters/formatter_spec.rb +0 -371
- data/spec/lib/formatters/org_formatter_spec.rb +0 -60
- data/spec/lib/formatters/text_formatter_spec.rb +0 -60
- data/spec/lib/table_spec.rb +0 -990
@@ -1,199 +0,0 @@
|
|
1
|
-
|
2
|
-
#+CAPTION: Goldberg
|
3
|
-
#+ATTR_LATEX: :font \footnotesize
|
4
|
-
#+NAME: goldberg
|
5
|
-
| Ref | Date | Code | Shares | Price | Info |
|
6
|
-
|---------+------------+------+----------+-------+------|
|
7
|
-
| 2841381 | 2016-11-04 | P | 2603.0 | 6.46 | |
|
8
|
-
| 2841382 | 2016-11-04 | S | 3800.0 | 6.45 | |
|
9
|
-
| 2841500 | 2016-11-04 | P | 3100.0 | 6.55 | |
|
10
|
-
| 2841501 | 2016-11-04 | S | 8200.0 | 6.35 | |
|
11
|
-
| 2843282 | 2016-11-07 | P | 300.0 | 6.17 | |
|
12
|
-
| 2843280 | 2016-11-07 | P | 3901.0 | 6.06 | |
|
13
|
-
| 2843283 | 2016-11-07 | S | 3900.0 | 6.0 | |
|
14
|
-
| 2843281 | 2016-11-07 | S | 1780.0 | 6.28 | |
|
15
|
-
| 2843279 | 2016-11-07 | S | 500.0 | 6.0 | |
|
16
|
-
| 2843420 | 2016-11-07 | S | 5822.0 | 5.98 | |
|
17
|
-
| 2843555 | 2016-11-07 | P | 2100.0 | 6.19 | |
|
18
|
-
| 2843556 | 2016-11-07 | S | 1150.0 | 6.15 | |
|
19
|
-
| 2843581 | 2016-11-08 | P | 1300.0 | 6.33 | |
|
20
|
-
| 2843573 | 2016-11-08 | P | 23600.0 | 6.39 | |
|
21
|
-
| 2843561 | 2016-11-08 | P | 200.0 | 6.25 | |
|
22
|
-
| 2843580 | 2016-11-08 | S | 8000.0 | 6.5 | |
|
23
|
-
| 2843579 | 2016-11-08 | P | 6200.0 | 6.54 | |
|
24
|
-
| 2843578 | 2016-11-08 | S | 200.0 | 6.6 | |
|
25
|
-
| 2843577 | 2016-11-08 | P | 25100.0 | 6.51 | |
|
26
|
-
| 2843576 | 2016-11-08 | S | 3924.0 | 6.41 | |
|
27
|
-
| 2843575 | 2016-11-08 | P | 8000.0 | 6.46 | |
|
28
|
-
| 2843574 | 2016-11-08 | S | 8900.0 | 6.45 | |
|
29
|
-
| 2843572 | 2016-11-08 | S | 1200.0 | 6.3 | |
|
30
|
-
| 2843571 | 2016-11-08 | P | 14500.0 | 6.36 | |
|
31
|
-
| 2843570 | 2016-11-08 | S | 8100.0 | 6.36 | |
|
32
|
-
| 2843569 | 2016-11-08 | P | 8400.0 | 6.44 | |
|
33
|
-
| 2843568 | 2016-11-08 | S | 3900.0 | 6.32 | |
|
34
|
-
| 2843567 | 2016-11-08 | P | 4800.0 | 6.25 | |
|
35
|
-
| 2843566 | 2016-11-08 | S | 400.0 | 6.15 | |
|
36
|
-
| 2843565 | 2016-11-08 | P | 13800.0 | 6.19 | |
|
37
|
-
| 2843564 | 2016-11-08 | S | 2700.0 | 6.15 | |
|
38
|
-
| 2843563 | 2016-11-08 | P | 3678.0 | 6.19 | |
|
39
|
-
| 2843562 | 2016-11-08 | S | 1600.0 | 6.05 | |
|
40
|
-
| 2843560 | 2016-11-08 | S | 500.0 | 6.18 | |
|
41
|
-
| 2843559 | 2016-11-08 | P | 100.0 | 6.45 | |
|
42
|
-
| 2843558 | 2016-11-08 | S | 2600.0 | 6.27 | |
|
43
|
-
| 2843557 | 2016-11-08 | P | 12900.0 | 6.26 | |
|
44
|
-
| 2843653 | 2016-11-07 | S | 11700.0 | 6.0 | |
|
45
|
-
| 2843652 | 2016-11-07 | P | 10000.0 | 6.09 | |
|
46
|
-
| 2843979 | 2016-11-07 | S | 6400.0 | 6.1 | |
|
47
|
-
| 2847295 | 2016-11-09 | S | 12461.0 | 6.55 | |
|
48
|
-
| 2847302 | 2016-11-09 | P | 4599.0 | 6.64 | |
|
49
|
-
| 2847301 | 2016-11-09 | S | 7500.0 | 6.61 | |
|
50
|
-
| 2847300 | 2016-11-09 | P | 66903.0 | 6.57 | |
|
51
|
-
| 2847299 | 2016-11-09 | S | 22100.0 | 6.56 | |
|
52
|
-
| 2847298 | 2016-11-09 | P | 13566.0 | 6.78 | |
|
53
|
-
| 2847297 | 2016-11-09 | S | 7700.0 | 6.6 | |
|
54
|
-
| 2847296 | 2016-11-09 | P | 28629.0 | 6.54 | |
|
55
|
-
| 2847294 | 2016-11-09 | P | 33222.0 | 6.55 | |
|
56
|
-
| 2847315 | 2016-11-10 | P | 13203.0 | 6.89 | |
|
57
|
-
| 2847314 | 2016-11-10 | S | 1200.0 | 6.75 | |
|
58
|
-
| 2847313 | 2016-11-10 | P | 11600.0 | 6.73 | |
|
59
|
-
| 2847312 | 2016-11-10 | S | 5900.0 | 6.7 | |
|
60
|
-
| 2847311 | 2016-11-10 | P | 48550.0 | 6.73 | |
|
61
|
-
| 2847310 | 2016-11-10 | S | 47555.0 | 6.86 | |
|
62
|
-
| 2847309 | 2016-11-10 | P | 68540.0 | 6.93 | |
|
63
|
-
| 2847308 | 2016-11-10 | S | 8700.0 | 6.8 | |
|
64
|
-
| 2847307 | 2016-11-10 | P | 16687.0 | 6.87 | |
|
65
|
-
| 2847306 | 2016-11-10 | S | 8710.0 | 6.75 | |
|
66
|
-
| 2847305 | 2016-11-10 | P | 10102.0 | 6.81 | |
|
67
|
-
| 2847304 | 2016-11-10 | S | 100.0 | 6.7 | |
|
68
|
-
| 2847303 | 2016-11-10 | P | 100.0 | 6.8 | |
|
69
|
-
| 2853726 | 2016-11-11 | S | 42281.0 | 7.01 | |
|
70
|
-
| 2853716 | 2016-11-11 | S | 22701.0 | 7.01 | |
|
71
|
-
| 2853741 | 2016-11-11 | P | 37700.0 | 6.94 | |
|
72
|
-
| 2853740 | 2016-11-11 | S | 93400.0 | 7.03 | |
|
73
|
-
| 2853739 | 2016-11-11 | P | 81272.0 | 7.06 | |
|
74
|
-
| 2853738 | 2016-11-11 | S | 600.0 | 7.0 | |
|
75
|
-
| 2853737 | 2016-11-11 | P | 200.0 | 7.0 | |
|
76
|
-
| 2853736 | 2016-11-11 | S | 14700.0 | 7.0 | |
|
77
|
-
| 2853735 | 2016-11-11 | P | 25000.0 | 7.03 | |
|
78
|
-
| 2853734 | 2016-11-11 | S | 84716.0 | 7.01 | |
|
79
|
-
| 2853733 | 2016-11-11 | P | 85000.0 | 7.05 | |
|
80
|
-
| 2853732 | 2016-11-11 | S | 31600.0 | 7.0 | |
|
81
|
-
| 2853731 | 2016-11-11 | P | 37300.0 | 7.05 | |
|
82
|
-
| 2853730 | 2016-11-11 | S | 56200.0 | 7.0 | |
|
83
|
-
| 2853729 | 2016-11-11 | P | 87000.0 | 7.07 | |
|
84
|
-
| 2853728 | 2016-11-11 | S | 65823.0 | 7.02 | |
|
85
|
-
| 2853727 | 2016-11-11 | P | 102090.0 | 7.04 | |
|
86
|
-
| 2853725 | 2016-11-11 | P | 39400.0 | 7.07 | |
|
87
|
-
| 2853724 | 2016-11-11 | S | 36500.0 | 7.0 | |
|
88
|
-
| 2853723 | 2016-11-11 | P | 42000.0 | 7.07 | |
|
89
|
-
| 2853722 | 2016-11-11 | S | 21900.0 | 7.0 | |
|
90
|
-
| 2853721 | 2016-11-11 | P | 20690.0 | 7.1 | |
|
91
|
-
| 2853720 | 2016-11-11 | S | 9100.0 | 7.0 | |
|
92
|
-
| 2853719 | 2016-11-11 | P | 12693.0 | 7.07 | |
|
93
|
-
| 2853718 | 2016-11-11 | S | 85200.0 | 7.13 | |
|
94
|
-
| 2853717 | 2016-11-11 | P | 102036.0 | 7.17 | |
|
95
|
-
| 2853715 | 2016-11-11 | P | 11487.0 | 7.1 | |
|
96
|
-
| 2856042 | 2016-11-14 | S | 85000.0 | 7.07 | |
|
97
|
-
| 2856062 | 2016-11-14 | S | 53071.0 | 7.05 | |
|
98
|
-
| 2856061 | 2016-11-14 | P | 56000.0 | 7.1 | |
|
99
|
-
| 2856060 | 2016-11-14 | S | 40024.0 | 7.05 | |
|
100
|
-
| 2856059 | 2016-11-14 | P | 5823.0 | 7.05 | |
|
101
|
-
| 2856058 | 2016-11-14 | S | 81639.0 | 7.05 | |
|
102
|
-
| 2856057 | 2016-11-14 | P | 75000.0 | 7.11 | |
|
103
|
-
| 2856056 | 2016-11-14 | S | 800.0 | 7.05 | |
|
104
|
-
| 2856055 | 2016-11-14 | P | 20650.0 | 6.95 | |
|
105
|
-
| 2856054 | 2016-11-14 | S | 56080.0 | 6.97 | |
|
106
|
-
| 2856053 | 2016-11-14 | P | 31835.0 | 6.98 | |
|
107
|
-
| 2856052 | 2016-11-14 | S | 62220.0 | 7.08 | |
|
108
|
-
| 2856051 | 2016-11-14 | P | 50000.0 | 7.15 | |
|
109
|
-
| 2856050 | 2016-11-14 | S | 36400.0 | 7.1 | |
|
110
|
-
| 2856049 | 2016-11-14 | P | 50000.0 | 7.15 | |
|
111
|
-
| 2856048 | 2016-11-14 | S | 6200.0 | 7.1 | |
|
112
|
-
| 2856047 | 2016-11-14 | P | 25000.0 | 7.15 | |
|
113
|
-
| 2856046 | 2016-11-14 | S | 111664.0 | 7.16 | |
|
114
|
-
| 2856045 | 2016-11-14 | P | 85000.0 | 7.17 | |
|
115
|
-
| 2856044 | 2016-11-14 | S | 76425.0 | 7.1 | |
|
116
|
-
| 2856043 | 2016-11-14 | P | 20660.0 | 7.14 | |
|
117
|
-
| 2856041 | 2016-11-14 | P | 142074.0 | 7.09 | |
|
118
|
-
| 2856070 | 2016-11-15 | P | 128.0 | 6.95 | |
|
119
|
-
| 2856069 | 2016-11-15 | S | 23778.0 | 7.0 | |
|
120
|
-
| 2856068 | 2016-11-15 | P | 20100.0 | 7.02 | |
|
121
|
-
| 2856067 | 2016-11-15 | S | 11400.0 | 7.0 | |
|
122
|
-
| 2856066 | 2016-11-15 | P | 600.0 | 7.03 | |
|
123
|
-
| 2856065 | 2016-11-15 | S | 52159.0 | 7.0 | |
|
124
|
-
| 2856064 | 2016-11-15 | P | 200.0 | 7.0 | |
|
125
|
-
| 2856063 | 2016-11-15 | S | 81000.0 | 7.0 | |
|
126
|
-
| 2862613 | 2016-11-16 | S | 1976.0 | 7.0 | |
|
127
|
-
| 2862612 | 2016-11-16 | P | 200.0 | 6.95 | |
|
128
|
-
| 2862611 | 2016-11-16 | S | 7986.0 | 6.98 | |
|
129
|
-
| 2862614 | 2016-11-17 | S | 1700.0 | 6.95 | |
|
130
|
-
| 2867746 | 2016-11-18 | S | 2421.0 | 6.95 | |
|
131
|
-
| 2867753 | 2016-11-21 | P | 51257.0 | 6.8 | |
|
132
|
-
| 2867752 | 2016-11-21 | S | 200.0 | 6.8 | |
|
133
|
-
| 2867751 | 2016-11-21 | P | 111027.0 | 6.8 | |
|
134
|
-
| 2867750 | 2016-11-21 | S | 300.0 | 6.9 | |
|
135
|
-
| 2867749 | 2016-11-21 | P | 1497.0 | 6.9 | |
|
136
|
-
| 2867748 | 2016-11-21 | S | 400.0 | 6.95 | |
|
137
|
-
| 2867747 | 2016-11-21 | P | 7936.0 | 6.9 | |
|
138
|
-
| 2867765 | 2016-11-21 | P | 400.0 | 6.75 | |
|
139
|
-
| 2867764 | 2016-11-21 | S | 104197.0 | 6.75 | |
|
140
|
-
| 2867763 | 2016-11-21 | P | 162284.0 | 6.74 | |
|
141
|
-
| 2867762 | 2016-11-21 | S | 9300.0 | 6.7 | |
|
142
|
-
| 2867761 | 2016-11-21 | P | 21054.0 | 6.75 | |
|
143
|
-
| 2867760 | 2016-11-21 | S | 2900.0 | 6.7 | |
|
144
|
-
| 2867759 | 2016-11-21 | P | 5500.0 | 6.65 | |
|
145
|
-
| 2867758 | 2016-11-21 | S | 140768.0 | 6.78 | |
|
146
|
-
| 2867757 | 2016-11-21 | P | 132400.0 | 6.82 | |
|
147
|
-
| 2867756 | 2016-11-21 | S | 77200.0 | 6.8 | |
|
148
|
-
| 2867755 | 2016-11-21 | P | 90334.0 | 6.84 | |
|
149
|
-
| 2867754 | 2016-11-21 | S | 28861.0 | 6.8 | |
|
150
|
-
| 2871516 | 2016-11-22 | P | 35209.0 | 6.76 | |
|
151
|
-
| 2871515 | 2016-11-22 | S | 35439.0 | 6.8 | |
|
152
|
-
| 2871514 | 2016-11-22 | P | 50000.0 | 6.82 | |
|
153
|
-
| 2875167 | 2016-11-23 | P | 6731.0 | 6.51 | |
|
154
|
-
| 2875166 | 2016-11-23 | S | 22024.0 | 6.6 | |
|
155
|
-
| 2875165 | 2016-11-23 | P | 75800.0 | 6.65 | |
|
156
|
-
| 2875164 | 2016-11-23 | S | 61600.0 | 6.62 | |
|
157
|
-
| 2875163 | 2016-11-23 | P | 19483.0 | 6.6 | |
|
158
|
-
| 2875162 | 2016-11-23 | S | 4400.0 | 6.65 | |
|
159
|
-
| 2875161 | 2016-11-23 | P | 25000.0 | 6.65 | |
|
160
|
-
| 2875160 | 2016-11-23 | S | 254000.0 | 6.7 | |
|
161
|
-
| 2875159 | 2016-11-23 | P | 171523.0 | 6.69 | |
|
162
|
-
| 2875158 | 2016-11-23 | S | 1400.0 | 6.8 | |
|
163
|
-
| 2875157 | 2016-11-23 | P | 100.0 | 6.8 | |
|
164
|
-
| 2876783 | 2016-11-25 | P | 12700.0 | 6.65 | |
|
165
|
-
| 2876785 | 2016-11-25 | P | 287.0 | 6.67 | |
|
166
|
-
| 2876784 | 2016-11-25 | S | 3688.0 | 6.65 | |
|
167
|
-
| 2876782 | 2016-11-25 | S | 7067.0 | 6.7 | |
|
168
|
-
| 2876793 | 2016-11-28 | P | 31025.0 | 6.62 | |
|
169
|
-
| 2876792 | 2016-11-28 | S | 36128.0 | 6.65 | |
|
170
|
-
| 2876791 | 2016-11-28 | P | 87822.0 | 6.64 | |
|
171
|
-
| 2876790 | 2016-11-28 | S | 33869.0 | 6.65 | |
|
172
|
-
| 2876789 | 2016-11-28 | P | 100.0 | 6.7 | |
|
173
|
-
| 2876788 | 2016-11-28 | S | 6858.0 | 6.7 | |
|
174
|
-
| 2876787 | 2016-11-28 | P | 67020.0 | 6.7 | |
|
175
|
-
| 2876786 | 2016-11-28 | S | 100.0 | 6.7 | |
|
176
|
-
| 2882349 | 2016-11-29 | S | 200.0 | 6.35 | |
|
177
|
-
| 2882348 | 2016-11-29 | P | 52300.0 | 6.35 | |
|
178
|
-
| 2882347 | 2016-11-29 | S | 14397.0 | 6.35 | |
|
179
|
-
| 2882346 | 2016-11-29 | P | 14032.0 | 6.4 | |
|
180
|
-
| 2882345 | 2016-11-29 | S | 31700.0 | 6.4 | |
|
181
|
-
| 2882343 | 2016-11-29 | S | 44392.0 | 6.45 | |
|
182
|
-
| 2882342 | 2016-11-29 | P | 35300.0 | 6.5 | |
|
183
|
-
| 2882341 | 2016-11-29 | S | 200.0 | 6.55 | |
|
184
|
-
| 2882339 | 2016-11-29 | S | 44775.0 | 6.5 | |
|
185
|
-
| 2882338 | 2016-11-29 | P | 94351.0 | 6.55 | |
|
186
|
-
| 2882337 | 2016-11-29 | S | 100.0 | 6.65 | |
|
187
|
-
| 2882344 | 2016-11-29 | P | 21000.0 | 6.4 | |
|
188
|
-
| 2882340 | 2016-11-29 | P | 300.0 | 6.53 | |
|
189
|
-
| 2882336 | 2016-11-29 | P | 100.0 | 6.6 | |
|
190
|
-
| 2883711 | 2016-11-30 | P | 631.0 | 6.02 | |
|
191
|
-
| 2883710 | 2016-11-30 | S | 10500.0 | 6.1 | |
|
192
|
-
| 2883709 | 2016-11-30 | P | 50100.0 | 6.03 | |
|
193
|
-
| 2883708 | 2016-11-30 | S | 21155.0 | 6.02 | |
|
194
|
-
| 2883707 | 2016-11-30 | P | 25000.0 | 6.19 | |
|
195
|
-
| 2883706 | 2016-11-30 | S | 36348.0 | 6.17 | |
|
196
|
-
| 2883705 | 2016-11-30 | P | 100.0 | 6.3 | |
|
197
|
-
| 2883704 | 2016-11-30 | S | 51345.0 | 6.29 | |
|
198
|
-
| 2883703 | 2016-11-30 | P | 15487.0 | 6.35 | |
|
199
|
-
| 2883702 | 2016-11-30 | S | 1300.0 | 6.4 | |
|
data/spec/example_files/wpcs.csv
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
Ref,Date,Code,RawShares,Shares,Price,Info
|
2
|
-
1,2006-05-02,P,5000,5000,8.6000,2006-08-09-1-I
|
3
|
-
2,2006-05-03,P,5000,5000,8.4200,2006-08-09-1-I
|
4
|
-
3,2006-05-04,P,5000,5000,8.4000,2006-08-09-1-I
|
5
|
-
4,2006-05-10,P,8600,8600,8.0200,2006-08-09-1-D
|
6
|
-
5,2006-05-12,P,10000,10000,7.2500,2006-08-09-1-D
|
7
|
-
6,2006-05-12,P,2000,2000,6.7400,2006-08-09-1-I
|
8
|
-
7,2006-05-16,P,5000,5000,7.0000,2006-08-09-1-D
|
9
|
-
8,2006-05-17,P,5000,5000,6.7000,2006-08-09-1-D
|
10
|
-
9,2006-05-17,P,2000,2000,6.7400,2006-08-09-1-I
|
11
|
-
10,2006-05-19,P,1000,1000,7.2500,2006-08-09-1-I
|
12
|
-
11,2006-05-19,P,1000,1000,7.2500,2006-08-09-1-I
|
13
|
-
12,2006-05-31,P,2000,2000,7.9200,2006-08-09-1-I
|
14
|
-
13,2006-06-05,P,1000,1000,7.9200,2006-08-09-1-I
|
15
|
-
14,2006-06-15,P,5000,5000,6.9800,2006-08-09-1-I
|
16
|
-
15,2006-06-16,P,1000,1000,6.9300,2006-08-09-1-I
|
17
|
-
16,2006-06-16,P,1000,1000,6.9400,2006-08-09-1-I
|
18
|
-
17,2006-06-29,P,4000,4000,7.0000,2006-08-09-1-I
|
19
|
-
18,2006-07-14,P,2000,2000,6.2000,2006-08-09-1-D
|
20
|
-
19,2006-08-03,P,1400,1400,4.3900,2006-08-09-1-D
|
21
|
-
20,2006-08-07,P,1100,1100,4.5900,2006-08-09-1-D
|
22
|
-
21,2006-08-08,P,16000,16000,4.7000,2006-08-21-1-D
|
23
|
-
22,2006-08-08,S,16000,16000,4.7000,2006-08-21-1-I
|
24
|
-
23,2006-08-15,P,16000,16000,4.8000,2006-08-21-1-D
|
25
|
-
24,2006-08-15,S,16000,16000,4.8000,2006-08-21-1-I
|
26
|
-
25,2006-08-16,P,2100,2100,5.2900,2006-08-21-1-I
|
27
|
-
26,2006-08-17,P,2900,2900,5.7000,2006-08-21-1-I
|
28
|
-
27,2006-08-23,P,8000,8000,5.2400,2006-08-25-1-D
|
29
|
-
28,2006-08-23,S,8000,8000,5.2400,2006-08-29-1-I
|
30
|
-
29,2006-08-28,P,1000,1000,5.4000,2006-08-29-1-D
|
31
|
-
30,2006-08-29,P,2000,2000,5.4000,2006-08-30-1-D
|
32
|
-
31,2006-08-29,S,2000,2000,5.4000,2006-08-30-1-I
|
33
|
-
32,2006-09-05,P,2700,2700,5.7500,2006-09-06-1-I
|
34
|
-
33,2006-09-11,P,4000,4000,5.7200,2006-09-15-1-D
|
35
|
-
34,2006-09-11,S,4000,4000,5.7200,2006-09-15-1-I
|
36
|
-
35,2006-09-12,P,3000,3000,5.4800,2006-09-15-2-I
|
37
|
-
36,2006-09-13,P,1700,1700,5.4100,2006-09-15-2-I
|
38
|
-
37,2006-09-20,P,7500,7500,5.4900,2006-09-21-1-I
|
39
|
-
38,2006-12-07,S,6000,6000,7.8900,2006-12-11-1-I
|
40
|
-
39,2006-12-11,S,100,100,8.0000,2006-12-11-1-I
|
41
|
-
40,2007-01-29,P,2500,2500,12.1000,2007-04-27-1-I
|
42
|
-
41,2007-01-31,P,2500,2500,13.7000,2007-04-27-1-I
|
43
|
-
42,2007-02-02,P,4000,4000,15.1500,2007-04-27-1-I
|
44
|
-
43,2007-02-06,P,5000,5000,14.9500,2007-04-27-1-I
|
45
|
-
44,2007-02-07,P,400,400,15.0000,2007-04-27-1-I
|
46
|
-
45,2007-02-08,P,4600,4600,15.0000,2007-04-27-1-I
|
47
|
-
46,2007-02-12,P,3500,3500,14.9100,2007-04-27-1-I
|
48
|
-
47,2007-02-13,P,1500,1500,14.6500,2007-04-27-1-D
|
49
|
-
48,2007-02-14,P,2000,2000,14.4900,2007-04-27-1-D
|
50
|
-
49,2007-02-15,P,3000,3000,14.3000,2007-04-27-1-I
|
51
|
-
50,2007-02-21,P,8500,8500,14.6500,2007-04-27-1-D
|
52
|
-
51,2007-02-21,S,8500,8500,14.6500,2007-04-27-1-I
|
53
|
-
52,2007-02-22,P,1500,1500,14.8800,2007-04-27-1-I
|
54
|
-
53,2007-02-23,P,3000,3000,14.9700,2007-04-27-1-I
|
55
|
-
54,2007-02-23,P,5000,5000,14.9700,2007-04-27-1-I
|
56
|
-
55,2007-02-27,P,5200,5200,13.8800,2007-04-27-1-I
|
57
|
-
56,2007-02-28,P,6700,6700,13.0000,2007-04-27-1-D
|
58
|
-
57,2007-02-28,P,800,800,13.0000,2007-04-27-1-I
|
59
|
-
58,2007-02-28,P,8400,8400,13.0000,2007-04-27-1-I
|
60
|
-
59,2007-03-01,P,2500,2500,12.2500,2007-04-27-1-D
|
61
|
-
60,2007-03-05,P,1800,1800,11.9700,2007-04-27-1-D
|
62
|
-
61,2007-03-06,P,500,500,12.1300,2007-04-27-1-D
|
63
|
-
62,2007-03-07,P,3000,3000,12.3700,2007-04-27-1-D
|
64
|
-
63,2007-03-08,P,2000,2000,12.6000,2007-04-27-1-I
|
65
|
-
64,2007-03-09,P,7700,7700,12.8100,2007-04-27-1-I
|
66
|
-
65,2007-03-12,P,4200,4200,12.4600,2007-04-27-1-I
|
67
|
-
66,2007-03-13,P,800,800,12.2500,2007-04-27-1-I
|
68
|
-
67,2007-03-19,P,2000,2000,14.5500,2007-04-27-2-I
|
69
|
-
68,2007-03-19,P,5000,5000,14.5500,2007-04-27-2-I
|
70
|
-
69,2007-03-19,P,2000,2000,14.3300,2007-04-27-2-I
|
71
|
-
70,2007-03-20,P,1000,1000,14.4600,2007-04-27-2-I
|
72
|
-
71,2007-03-20,P,1500,1500,14.4600,2007-04-27-2-I
|
73
|
-
72,2007-03-21,P,3900,3900,16.9000,2007-04-27-2-I
|
74
|
-
73,2007-03-23,P,8000,8000,14.9700,2007-04-27-1-D
|
75
|
-
74,2007-03-27,P,1000,1000,16.9300,2007-04-27-2-I
|
76
|
-
75,2007-03-28,P,1000,1000,16.5000,2007-04-27-2-D
|
77
|
-
76,2007-03-29,P,1000,1000,16.2500,2007-04-27-2-D
|
78
|
-
77,2007-04-04,P,200,200,17.8600,2007-04-27-2-I
|
79
|
-
78,2007-04-04,P,2000,2000,19.5000,2007-04-27-2-I
|
80
|
-
79,2007-04-04,P,3000,3000,19.1300,2007-04-27-2-I
|
81
|
-
80,2007-04-05,P,1000,1000,19.1500,2007-04-27-2-I
|
82
|
-
81,2007-04-10,P,2000,2000,20.7500,2007-04-27-2-I
|
83
|
-
82,2007-04-11,P,1000,1000,20.5000,2007-04-27-2-I
|
84
|
-
83,2007-04-12,P,600,600,21.5000,2007-04-27-2-I
|
85
|
-
84,2007-04-12,P,1000,1000,21.4500,2007-04-27-2-I
|
86
|
-
85,2007-04-13,P,2100,2100,21.5000,2007-04-27-2-I
|
87
|
-
86,2007-04-16,P,500,500,22.6000,2007-04-27-2-I
|
88
|
-
87,2007-04-17,P,3500,3500,23.5500,2007-04-27-2-D
|
89
|
-
88,2007-04-17,S,3500,3500,23.5500,2007-04-27-2-I
|
90
|
-
89,2007-04-23,P,5000,5000,23.4500,2007-04-27-2-I
|
91
|
-
90,2007-04-24,P,5000,5000,24.3000,2007-04-27-2-I
|
92
|
-
91,2007-04-25,S,10000,10000,25.7000,2007-04-27-2-I
|
data/spec/lib/column_spec.rb
DELETED
@@ -1,224 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module FatCore
|
4
|
-
describe Column do
|
5
|
-
describe 'construction' do
|
6
|
-
it 'should be able to append items to the column' do
|
7
|
-
c = Column.new(header: 'junk')
|
8
|
-
expect(c.type).to eq('NilClass')
|
9
|
-
c << '2.71828'
|
10
|
-
expect(c.items).to eq([2.71828])
|
11
|
-
expect(c.type).to eq('Numeric')
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should leave the type of an all-nil column open' do
|
15
|
-
c = Column.new(header: :bool, items: [nil, nil, nil, nil])
|
16
|
-
expect(c.type).to eq('NilClass')
|
17
|
-
expect(c[0]).to eq(nil)
|
18
|
-
expect(c[1]).to eq(nil)
|
19
|
-
expect(c[2]).to eq(nil)
|
20
|
-
expect(c[3]).to eq(nil)
|
21
|
-
# But then, assign a type when a recognizable type comes along.
|
22
|
-
c << '625.18'
|
23
|
-
expect(c.type).to eq('Numeric')
|
24
|
-
expect { c << '2018-05-06' }.to raise_error /already typed as Numeric/
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should recognize boolean columns' do
|
28
|
-
c = Column.new(header: :bool, items: [nil, 'F', 'F', 'T'])
|
29
|
-
expect(c.type).to eq('Boolean')
|
30
|
-
c = Column.new(header: :bool,
|
31
|
-
items: [nil, 'N', 'no', 'yes', 'false', 'TRUE', nil])
|
32
|
-
expect(c.type).to eq('Boolean')
|
33
|
-
expect(c[0]).to eq(nil)
|
34
|
-
expect(c[1]).to eq(false)
|
35
|
-
expect(c[2]).to eq(false)
|
36
|
-
expect(c[3]).to eq(true)
|
37
|
-
expect(c[4]).to eq(false)
|
38
|
-
expect(c[5]).to eq(true)
|
39
|
-
expect(c[6]).to eq(nil)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should recognize DateTime columns but allow Date and nil' do
|
43
|
-
c = Column.new(header: :when,
|
44
|
-
items: [nil, '2015-01-21', '[2015-01-12]',
|
45
|
-
'<2011-01-06>', nil, '<2017-01-25 Wed 10:00>'])
|
46
|
-
expect(c.type).to eq('DateTime')
|
47
|
-
expect(c[0]).to eq(nil)
|
48
|
-
expect(c[1]).to eq(Date.parse('2015-01-21'))
|
49
|
-
expect(c[2]).to eq(Date.parse('2015-01-12'))
|
50
|
-
expect(c[3]).to eq(Date.parse('2011-01-06'))
|
51
|
-
expect(c[4]).to eq(nil)
|
52
|
-
expect(c[5]).to eq(DateTime.parse('2017-01-25 Wed 10:00'))
|
53
|
-
expect(c[1].class).to eq(Date)
|
54
|
-
expect(c[5].class).to eq(DateTime)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'should recognize Numeric columns but allow nils and Integers' do
|
58
|
-
c = Column.new(header: :when,
|
59
|
-
items: [nil, '20151', '3.14159',
|
60
|
-
BigDecimal('2.718281828'), nil,
|
61
|
-
'45024098204982340982049802348'])
|
62
|
-
expect(c.type).to eq('Numeric')
|
63
|
-
expect(c[0]).to eq(nil)
|
64
|
-
expect(c[1]).to eq(20151)
|
65
|
-
expect(c[2]).to eq(3.14159)
|
66
|
-
expect(c[3]).to eq(2.718281828)
|
67
|
-
expect(c[4]).to eq(nil)
|
68
|
-
expect(c[5]).to eq(45024098204982340982049802348)
|
69
|
-
expect(c[0].class).to eq(NilClass)
|
70
|
-
expect(c[1].class).to eq(Fixnum)
|
71
|
-
expect(c[2].class).to eq(BigDecimal)
|
72
|
-
expect(c[3].class).to eq(BigDecimal)
|
73
|
-
expect(c[4].class).to eq(NilClass)
|
74
|
-
expect(c[5].class).to eq(Bignum)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'should recognize String columns but allow nils and Integers' do
|
78
|
-
c = Column.new(header: :when,
|
79
|
-
items: [nil, 'Four', 'score', 'and', nil, '7 years'])
|
80
|
-
expect(c.type).to eq('String')
|
81
|
-
expect(c[0]).to eq(nil)
|
82
|
-
expect(c[1]).to eq('Four')
|
83
|
-
expect(c[2]).to eq('score')
|
84
|
-
expect(c[3]).to eq('and')
|
85
|
-
expect(c[4]).to eq(nil)
|
86
|
-
expect(c[5]).to eq('7 years')
|
87
|
-
expect(c[0].class).to eq(NilClass)
|
88
|
-
expect(c[1].class).to eq(String)
|
89
|
-
expect(c[2].class).to eq(String)
|
90
|
-
expect(c[3].class).to eq(String)
|
91
|
-
expect(c[4].class).to eq(NilClass)
|
92
|
-
expect(c[5].class).to eq(String)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe 'attribute getting and setting' do
|
97
|
-
it 'should be able to retrieve items by index number' do
|
98
|
-
c = Column.new(header: :when,
|
99
|
-
items: [nil, '20151', '3.14159',
|
100
|
-
BigDecimal('2.718281828'), nil,
|
101
|
-
'45024098204982340982049802348'])
|
102
|
-
expect(c[0]).to eq(nil)
|
103
|
-
expect(c[1]).to eq(20151)
|
104
|
-
expect(c[2]).to eq(3.14159)
|
105
|
-
expect(c[3]).to eq(2.718281828)
|
106
|
-
expect(c[4]).to eq(nil)
|
107
|
-
expect(c[5]).to eq(45024098204982340982049802348)
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'should respond to to_a, size, empty?, and last_i' do
|
111
|
-
arr = [nil, '20151', '3.14159',
|
112
|
-
BigDecimal('2.718281828'), nil,
|
113
|
-
'45024098204982340982049802348']
|
114
|
-
c = Column.new(header: :when, items: arr)
|
115
|
-
expect(c.to_a).to eq([nil, 20151, 3.14159, 2.718281828,
|
116
|
-
nil, 45024098204982340982049802348])
|
117
|
-
expect(c.to_a.class).to eq(Array)
|
118
|
-
expect(c.size).to eq(6)
|
119
|
-
expect(c.empty?).to eq(false)
|
120
|
-
expect(c.last_i).to eq(5)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe 'aggregates' do
|
125
|
-
before :each do
|
126
|
-
@nil_col =
|
127
|
-
Column.new(header: :none, items: [nil, nil, nil, nil])
|
128
|
-
@bool_col =
|
129
|
-
Column.new(header: :bool,
|
130
|
-
items: [nil, 'N', 'no', 'yes', 'false', 'TRUE', nil])
|
131
|
-
@date_col =
|
132
|
-
Column.new(header: :when,
|
133
|
-
items: [nil, '2015-01-21', '[2015-01-12]',
|
134
|
-
'<2011-01-06>', nil, '<2017-01-25 Wed 10:00>'])
|
135
|
-
@num_col =
|
136
|
-
Column.new(header: :nums,
|
137
|
-
items: [nil, '20151', '3.14159',
|
138
|
-
BigDecimal('2.718281828'), nil, '45024'])
|
139
|
-
@str_col =
|
140
|
-
Column.new(header: :strs,
|
141
|
-
items: [nil, 'Four', 'score', 'and', nil, '7 years'])
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'should be able to apply first to appropriate columns' do
|
145
|
-
expect(@nil_col.first).to eq(nil)
|
146
|
-
expect(@bool_col.first).to eq(false)
|
147
|
-
expect(@date_col.first).to eq(Date.parse('2015-01-21'))
|
148
|
-
expect(@num_col.first).to eq(20151)
|
149
|
-
expect(@str_col.first).to eq('Four')
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'should be able to apply last to appropriate columns' do
|
153
|
-
expect(@nil_col.last).to eq(nil)
|
154
|
-
expect(@bool_col.last).to eq(true)
|
155
|
-
expect(@date_col.last).to eq(DateTime.parse('2017-01-25 10am'))
|
156
|
-
expect(@num_col.last).to eq(45024)
|
157
|
-
expect(@str_col.last).to eq('7 years')
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'should be able to apply rng to appropriate columns' do
|
161
|
-
expect(@nil_col.rng).to eq('..')
|
162
|
-
expect(@bool_col.rng).to eq('false..true')
|
163
|
-
expect(@date_col.rng).to eq('2015-01-21..2017-01-25T10:00:00+00:00')
|
164
|
-
expect(@num_col.rng).to eq('20151..45024')
|
165
|
-
expect(@str_col.rng).to eq('Four..7 years')
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'should be able to sum to appropriate columns' do
|
169
|
-
expect { @nil_col.sum }.to raise_error(/cannot be applied/)
|
170
|
-
expect { @bool_col.sum }.to raise_error(/cannot be applied/)
|
171
|
-
expect { @date_col.sum }.to raise_error(/cannot be applied/)
|
172
|
-
expect(@num_col.sum).to eq(65180.859871828)
|
173
|
-
expect(@str_col.sum).to eq('Fourscoreand7 years')
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'should be able to min to appropriate columns' do
|
177
|
-
expect(@nil_col.min).to eq(nil)
|
178
|
-
expect { @bool_col.min }.to raise_error(/cannot be applied/)
|
179
|
-
expect(@date_col.min).to eq(Date.parse('2011-01-06'))
|
180
|
-
expect(@num_col.min).to eq(BigDecimal('2.718281828'))
|
181
|
-
expect(@str_col.min).to eq('7 years')
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'should be able to max to appropriate columns' do
|
185
|
-
expect(@nil_col.max).to eq(nil)
|
186
|
-
expect { @bool_col.max }.to raise_error(/cannot be applied/)
|
187
|
-
expect(@date_col.max).to eq(DateTime.parse('2017-01-25 10am'))
|
188
|
-
expect(@num_col.max).to eq(45024)
|
189
|
-
expect(@str_col.max).to eq('score')
|
190
|
-
end
|
191
|
-
|
192
|
-
it 'should be able to apply avg to appropriate columns' do
|
193
|
-
expect { @nil_col.avg }.to raise_error(/cannot be applied/)
|
194
|
-
expect { @bool_col.avg }.to raise_error(/cannot be applied/)
|
195
|
-
expect(@date_col.avg).to eq(DateTime.parse('2014-07-17 12pm'))
|
196
|
-
expect(@num_col.avg).to eq(16295.214967957)
|
197
|
-
expect { @str_col.avg }.to raise_error(/cannot be applied/)
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'should be able to apply var to appropriate columns' do
|
201
|
-
expect { @nil_col.var }.to raise_error(/cannot be applied/)
|
202
|
-
expect { @bool_col.var }.to raise_error(/cannot be applied/)
|
203
|
-
expect(@date_col.var).to eq(644_564.25)
|
204
|
-
expect(@num_col.var.round(5)).to eq(342_771_817.71273)
|
205
|
-
expect { @str_col.var }.to raise_error(/cannot be applied/)
|
206
|
-
end
|
207
|
-
|
208
|
-
it 'should be able to apply dev to appropriate columns' do
|
209
|
-
expect { @nil_col.dev }.to raise_error(/cannot be applied/)
|
210
|
-
expect { @bool_col.dev }.to raise_error(/cannot be applied/)
|
211
|
-
expect(@date_col.dev).to eq(802.8475882756328)
|
212
|
-
expect(@num_col.dev).to eq(18_514.097809851042)
|
213
|
-
expect { @str_col.dev }.to raise_error(/cannot be applied/)
|
214
|
-
end
|
215
|
-
|
216
|
-
it 'should be able to apply boolean aggregates to boolean columns' do
|
217
|
-
expect(@bool_col.any?).to eq(true)
|
218
|
-
expect(@bool_col.all?).to eq(false)
|
219
|
-
expect(@bool_col.none?).to eq(false)
|
220
|
-
expect(@bool_col.one?).to eq(false)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
data/spec/lib/evaluator_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module FatCore
|
4
|
-
describe Evaluator do
|
5
|
-
it 'should be able to evaluate a simple expression' do
|
6
|
-
vars = { a: 23, b: 14, c: 'hello', d: Date.today }
|
7
|
-
ev = Evaluator.new(vars: vars)
|
8
|
-
lvars = { x: 77, y: 88, z: Rational(1, 3) }
|
9
|
-
expect(ev.evaluate('@a + @b', vars: lvars)).to eq(37)
|
10
|
-
expect(ev.evaluate('x + y', vars: lvars)).to eq(165)
|
11
|
-
expect(ev.evaluate('@a + y', vars: lvars)).to eq(111)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should be able to evaluate with a before hook' do
|
15
|
-
vars = { a: 23, b: 14, c: 'hello', d: Date.today }
|
16
|
-
ev = Evaluator.new(vars: vars, before: '@d += 1')
|
17
|
-
lvars = { x: 77, y: 88, z: Rational(1, 3) }
|
18
|
-
expect(ev.evaluate('@d', vars: lvars)).to eq(Date.today + 1)
|
19
|
-
expect(ev.evaluate('@d', vars: lvars)).to eq(Date.today + 2)
|
20
|
-
expect(ev.evaluate('@d', vars: lvars)).to eq(Date.today + 3)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should be able to evaluate with an after hook' do
|
24
|
-
vars = { a: 23, b: 114, c: 'hello', d: Date.today }
|
25
|
-
ev = Evaluator.new(vars: vars, after: '@b = @b * z')
|
26
|
-
lvars = { x: 77, y: 88, z: Rational(1, 3) }
|
27
|
-
# Note: since @b is not evaluated until after the expression, the result
|
28
|
-
# of multiplying by z (1/3) does not appear until the following eval.
|
29
|
-
expect(ev.evaluate('@b', vars: lvars)).to eq(114)
|
30
|
-
expect(ev.evaluate('@b', vars: lvars)).to eq(Rational(38, 1))
|
31
|
-
expect(ev.evaluate('@b', vars: lvars)).to eq(Rational(38, 3))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module FatCore
|
4
|
-
describe AoaFormatter do
|
5
|
-
describe 'table output' do
|
6
|
-
before :each do
|
7
|
-
@aoa =
|
8
|
-
[['Ref', 'Date', 'Code', 'Raw', 'Shares', 'Price', 'Info', 'Bool'],
|
9
|
-
nil,
|
10
|
-
[1, '2013-05-02', 'P', 795_546.20, 795_546.2, 1.1850, 'ZMPEF1', 'T'],
|
11
|
-
[2, '2013-05-02', 'P', 118_186.40, 118_186.4, 11.8500, 'ZMPEF1', 'T'],
|
12
|
-
[5, '2013-05-02', 'P', 118_186.40, 118_186.4, 11.8500, 'ZMPEF1\'s "Ent"', 'T'],
|
13
|
-
[7, '2013-05-20', 'S', 12_000.00, 5046.00, 28.2804, 'ZMEAC', 'F'],
|
14
|
-
[8, '2013-05-20', 'S', 85_000.00, 35_742.50, 28.3224, 'ZMEAC', 'T'],
|
15
|
-
[9, '2013-05-20', 'S', 33_302.00, 14_003.49, 28.6383, 'ZMEAC', 'T'],
|
16
|
-
[10, '2013-05-23', 'S', 8000.00, 3364.00, 27.1083, 'ZMEAC', 'T'],
|
17
|
-
[11, '2013-05-23', 'S', 23_054.00, 9694.21, 26.8015, 'ZMEAC', 'F'],
|
18
|
-
[12, '2013-05-23', 'S', 39_906.00, 16_780.47, 25.1749, 'ZMEAC', 'T'],
|
19
|
-
[13, '2013-05-29', 'S', 13_459.00, 5659.51, 24.7464, 'ZMEAC', 'T'],
|
20
|
-
[14, '2013-05-29', 'S', 15_700.00, 6601.85, 24.7790, 'ZMEAC', 'F'],
|
21
|
-
[15, '2013-05-29', 'S', 15_900.00, 6685.95, 24.5802, 'ZMEAC', 'T'],
|
22
|
-
[16, '2013-05-30', 'S', 6_679.00, 2808.52, 25.0471, 'ZMEAC', 'T']]
|
23
|
-
@tab = Table.from_aoa(@aoa).order_by(:date)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should be able to output a table with default formatting instructions' do
|
27
|
-
aoa = AoaFormatter.new(@tab).output
|
28
|
-
expect(aoa.class).to eq(Array)
|
29
|
-
expect(aoa.first.class).to eq(Array)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should be able to set format and output by method calls' do
|
33
|
-
fmt = AoaFormatter.new(@tab)
|
34
|
-
fmt.format(ref: '5.0', code: 'C', raw: ',0.0R', shares: ',0.0R',
|
35
|
-
price: '0.3', bool: 'Y')
|
36
|
-
fmt.format_for(:header, string: 'CB')
|
37
|
-
fmt.sum_gfooter(:price, :raw, :shares)
|
38
|
-
fmt.gfooter('Grp Std Dev', price: :dev, shares: :dev, bool: :one?)
|
39
|
-
fmt.sum_footer(:price, :raw, :shares)
|
40
|
-
fmt.footer('Std Dev', price: :dev, shares: :dev, bool: :all?)
|
41
|
-
fmt.footer('Any?', bool: :any?)
|
42
|
-
aoa = fmt.output
|
43
|
-
expect(aoa.size).to eq(45)
|
44
|
-
expect(aoa.first.first).to eq('Ref')
|
45
|
-
expect(aoa.first.last).to eq('Bool')
|
46
|
-
expect(aoa[1]).to be_nil
|
47
|
-
expect(aoa[2][0]).to eq('00001')
|
48
|
-
expect(aoa[2][1]).to eq('2013-05-02')
|
49
|
-
expect(aoa[2][2]).to eq('P')
|
50
|
-
expect(aoa[2][3]).to eq('795,546')
|
51
|
-
expect(aoa[2][4]).to eq('795,546')
|
52
|
-
expect(aoa[2][5]).to eq('1.185')
|
53
|
-
expect(aoa[2][6]).to eq('ZMPEF1')
|
54
|
-
expect(aoa[2][7]).to eq('Y')
|
55
|
-
expect(aoa[6][0]).to eq('Group Total')
|
56
|
-
expect(aoa[6][3]).to eq('1,031,919')
|
57
|
-
expect(aoa[6][4]).to eq('1,031,919')
|
58
|
-
expect(aoa[6][5]).to eq('24.885')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module FatCore
|
4
|
-
describe AohFormatter do
|
5
|
-
describe 'table output' do
|
6
|
-
before :each do
|
7
|
-
@aoa =
|
8
|
-
[['Ref', 'Date', 'Code', 'Raw', 'Shares', 'Price', 'Info', 'Bool'],
|
9
|
-
nil,
|
10
|
-
[1, '2013-05-02', 'P', 795_546.20, 795_546.2, 1.1850, 'ZMPEF1', 'T'],
|
11
|
-
[2, '2013-05-02', 'P', 118_186.40, 118_186.4, 11.8500, 'ZMPEF1', 'T'],
|
12
|
-
[5, '2013-05-02', 'P', 118_186.40, 118_186.4, 11.8500, 'ZMPEF1\'s "Ent"', 'T'],
|
13
|
-
[7, '2013-05-20', 'S', 12_000.00, 5046.00, 28.2804, 'ZMEAC', 'F'],
|
14
|
-
[8, '2013-05-20', 'S', 85_000.00, 35_742.50, 28.3224, 'ZMEAC', 'T'],
|
15
|
-
[9, '2013-05-20', 'S', 33_302.00, 14_003.49, 28.6383, 'ZMEAC', 'T'],
|
16
|
-
[10, '2013-05-23', 'S', 8000.00, 3364.00, 27.1083, 'ZMEAC', 'T'],
|
17
|
-
[11, '2013-05-23', 'S', 23_054.00, 9694.21, 26.8015, 'ZMEAC', 'F'],
|
18
|
-
[12, '2013-05-23', 'S', 39_906.00, 16_780.47, 25.1749, 'ZMEAC', 'T'],
|
19
|
-
[13, '2013-05-29', 'S', 13_459.00, 5659.51, 24.7464, 'ZMEAC', 'T'],
|
20
|
-
[14, '2013-05-29', 'S', 15_700.00, 6601.85, 24.7790, 'ZMEAC', 'F'],
|
21
|
-
[15, '2013-05-29', 'S', 15_900.00, 6685.95, 24.5802, 'ZMEAC', 'T'],
|
22
|
-
[16, '2013-05-30', 'S', 6_679.00, 2808.52, 25.0471, 'ZMEAC', 'T']]
|
23
|
-
@tab = Table.from_aoa(@aoa).order_by(:date)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should be able to output a table with default formatting instructions' do
|
27
|
-
aoh = AohFormatter.new(@tab).output
|
28
|
-
expect(aoh.class).to eq(Array)
|
29
|
-
expect(aoh.first.class).to eq(Hash)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should be able to set format and output by method calls' do
|
33
|
-
fmt = AohFormatter.new(@tab)
|
34
|
-
fmt.format(ref: '5.0', code: 'C', raw: ',0.0R', shares: ',0.0R',
|
35
|
-
price: '0.3', bool: 'Y')
|
36
|
-
fmt.format_for(:header, string: 'CB')
|
37
|
-
fmt.sum_gfooter(:price, :raw, :shares)
|
38
|
-
fmt.gfooter('Grp Std Dev', price: :dev, shares: :dev, bool: :one?)
|
39
|
-
fmt.sum_footer(:price, :raw, :shares)
|
40
|
-
fmt.footer('Std Dev', price: :dev, shares: :dev, bool: :all?)
|
41
|
-
fmt.footer('Any?', bool: :any?)
|
42
|
-
aoh = fmt.output
|
43
|
-
expect(aoh.size).to eq(43)
|
44
|
-
expect(aoh.first.keys.first).to eq(:ref)
|
45
|
-
expect(aoh.first.keys.last).to eq(:bool)
|
46
|
-
expect(aoh[0][:ref]).to eq('00001')
|
47
|
-
expect(aoh[0][:date]).to eq('2013-05-02')
|
48
|
-
expect(aoh[0][:code]).to eq('P')
|
49
|
-
expect(aoh[0][:raw]).to eq('795,546')
|
50
|
-
expect(aoh[0][:shares]).to eq('795,546')
|
51
|
-
expect(aoh[0][:price]).to eq('1.185')
|
52
|
-
expect(aoh[0][:info]).to eq('ZMPEF1')
|
53
|
-
expect(aoh[0][:bool]).to eq('Y')
|
54
|
-
expect(aoh[4][:ref]).to eq('Group Total')
|
55
|
-
expect(aoh[4][:shares]).to eq('1,031,919')
|
56
|
-
expect(aoh[4][:raw]).to eq('1,031,919')
|
57
|
-
expect(aoh[4][:price]).to eq('24.885')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|