quandl_operation 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/quandl/operation/collapse.rb +9 -2
- data/lib/quandl/operation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6530a186534168df1225e1db42cdc01e73bc4b9d
|
4
|
+
data.tar.gz: 4aed60d64fc25da6b8cd240a01e9d8238bffe560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05bddb5882c358217a122c9efd78d4a55c1d64c356711bb3e156b940cf99d14ad419b0b74d3ce92e6a403deda13e475bca570c309c9e0768c79cd37f760576c
|
7
|
+
data.tar.gz: e1a6baf5c8586ee53136f6cef160d63db64cd75322a5333bebf813f5720fb24548e0fffea78482dbf8dfa52e3ea3cccbe353be0302c23f24688fc24add9d413f
|
@@ -11,6 +11,7 @@ class Collapse
|
|
11
11
|
def perform(data, frequency)
|
12
12
|
data = Parse.sort( data )
|
13
13
|
data = collapse_and_log(data, frequency)
|
14
|
+
|
14
15
|
data
|
15
16
|
end
|
16
17
|
|
@@ -35,9 +36,15 @@ class Collapse
|
|
35
36
|
# consider the value for the next range
|
36
37
|
collapsed_data[range] = value if inside_range?(date, range) && value.present?
|
37
38
|
end
|
38
|
-
collapsed_data
|
39
|
+
to_table(collapsed_data)
|
39
40
|
end
|
40
|
-
|
41
|
+
|
42
|
+
def to_table(data)
|
43
|
+
data.collect do |date, values|
|
44
|
+
values.unshift(date)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
41
48
|
def frequency?(data)
|
42
49
|
Guess.frequency(data)
|
43
50
|
end
|