quandl_operation 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/quandl/operation/parse.rb +12 -3
- data/lib/quandl/operation/version.rb +1 -1
- metadata +15 -5
- checksums.yaml +0 -7
@@ -11,7 +11,7 @@ class Parse
|
|
11
11
|
return [] if data.blank?
|
12
12
|
t1 = Time.now
|
13
13
|
data = csv(data)
|
14
|
-
data =
|
14
|
+
data = unknown_date_format_to_julian(data)
|
15
15
|
data = sort(data)
|
16
16
|
CommonLogger.debug "#{self.name}.perform (#{t1.elapsed.microseconds}ms)"
|
17
17
|
data
|
@@ -47,7 +47,16 @@ class Parse
|
|
47
47
|
def sort_desc(data)
|
48
48
|
data.sort_by{|r| r[0] }.reverse
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
|
+
def unknown_date_format_to_julian(data)
|
52
|
+
return data unless data.present? && data[0] && data[0][0]
|
53
|
+
date = data[0][0]
|
54
|
+
# formatted like: "2013-06-18"
|
55
|
+
return date_to_julian(data) if date.is_a?(String) && date =~ /[0-9]{4}-[0-9]{2}-[0-9]{2}/
|
56
|
+
# formatted like: "2456463"
|
57
|
+
return julian_string_to_integer(data)
|
58
|
+
end
|
59
|
+
|
51
60
|
def date_to_julian(data)
|
52
61
|
return data if data[0][0].is_a?(Integer)
|
53
62
|
# dont alter by reference
|
@@ -105,7 +114,7 @@ class Parse
|
|
105
114
|
new_row
|
106
115
|
end
|
107
116
|
end
|
108
|
-
|
117
|
+
|
109
118
|
end
|
110
119
|
|
111
120
|
end
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quandl_operation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Blkae Hilscher
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-19 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rspec
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: fivemat
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: activesupport
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - '>='
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - '>='
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -100,26 +109,27 @@ files:
|
|
100
109
|
homepage: http://blake.hilscher.ca/
|
101
110
|
licenses:
|
102
111
|
- MIT
|
103
|
-
metadata: {}
|
104
112
|
post_install_message:
|
105
113
|
rdoc_options: []
|
106
114
|
require_paths:
|
107
115
|
- lib
|
108
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
109
118
|
requirements:
|
110
119
|
- - '>='
|
111
120
|
- !ruby/object:Gem::Version
|
112
121
|
version: '0'
|
113
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
114
124
|
requirements:
|
115
125
|
- - '>='
|
116
126
|
- !ruby/object:Gem::Version
|
117
127
|
version: '0'
|
118
128
|
requirements: []
|
119
129
|
rubyforge_project:
|
120
|
-
rubygems_version:
|
130
|
+
rubygems_version: 1.8.25
|
121
131
|
signing_key:
|
122
|
-
specification_version:
|
132
|
+
specification_version: 3
|
123
133
|
summary: For altering data
|
124
134
|
test_files:
|
125
135
|
- spec/quandl_operation_collapse_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 05e5f9d47bdf83810f79f6b8a37188dc94f12cf9
|
4
|
-
data.tar.gz: ecf763f48dd1aac2f09b8ca3c98f6dfe8cfa4c55
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 751b4db079b8815a4b00f4968ac5c6663e5d5bbbc9e723cffb3afb147362421ca827cfaa17ea6dc1c1eb48066aef7ce04a72e30b437da93e7c7fb3c419b78814
|
7
|
-
data.tar.gz: 7e79ce4797c7af22e19511f39c03a7848ee8ab03670adcdf3b823c5ad746e296a53b68e145a343739674db39f6e222e7bc7112668535e38e8a3df765a463d613
|