quandl_babelfish 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -10
- data/UPGRADE.md +5 -0
- data/lib/quandl/babelfish/version.rb +1 -1
- data/lib/quandl/babelfish.rb +0 -3
- data/quandl_babelfish.gemspec +0 -2
- metadata +2 -19
- data/lib/quandl/babelfish/data.rb +0 -37
- data/spec/lib/quandl/babelfish/data_spec.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a53ee0db1ee101721529efaabecca18f5afb20c3
|
4
|
+
data.tar.gz: 955834a837b73a4154b8fff0510c7c6db6e9f98c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a0a066227348ad185b74c653bcd89d2be752b74efb9724757e0d17d2928a9010866d64b078f5ff02143bf9dfc17c3c786bf4d76ade3f7930bcfd3423062baf8
|
7
|
+
data.tar.gz: fbd1df51422791838162a0e43e562b9d0e9ca272d2af427eceb69d032dbd00d9f46b2f444c5ec5da1754eeef571485f2ddc0efdbc3484d2f5259cb8d1e866036
|
data/Gemfile
CHANGED
@@ -1,11 +1,2 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
|
-
gemspec
|
3
|
-
|
4
|
-
|
5
|
-
use_local_gems = ENV['BUNDLE_LOCAL_GEMS'] == "true" && ENV['BUNDLE_LOCAL_DIR']
|
6
|
-
local_gem_dir = ENV['BUNDLE_LOCAL_DIR']
|
7
|
-
|
8
|
-
if use_local_gems
|
9
|
-
gem 'quandl_data', path: "#{local_gem_dir}/quandl/data"
|
10
|
-
gem 'quandl_operation', path: "#{local_gem_dir}/quandl/operation"
|
11
|
-
end
|
2
|
+
gemspec
|
data/UPGRADE.md
CHANGED
data/lib/quandl/babelfish.rb
CHANGED
data/quandl_babelfish.gemspec
CHANGED
@@ -16,8 +16,6 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_runtime_dependency "quandl_data", "~> 1.3"
|
20
|
-
|
21
19
|
s.add_development_dependency "rspec", "~> 2.13"
|
22
20
|
s.add_development_dependency "pry"
|
23
21
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quandl_babelfish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Ryshkevich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: quandl_data
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.3'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.3'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rspec
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +53,6 @@ files:
|
|
67
53
|
- UPGRADE.md
|
68
54
|
- lib/quandl/babelfish.rb
|
69
55
|
- lib/quandl/babelfish/cleaner.rb
|
70
|
-
- lib/quandl/babelfish/data.rb
|
71
56
|
- lib/quandl/babelfish/date_maid.rb
|
72
57
|
- lib/quandl/babelfish/number_maid.rb
|
73
58
|
- lib/quandl/babelfish/version.rb
|
@@ -76,7 +61,6 @@ files:
|
|
76
61
|
- lib/quandl/error/unknown_date_format.rb
|
77
62
|
- quandl_babelfish.gemspec
|
78
63
|
- spec/lib/quandl/babelfish/cleaner_spec.rb
|
79
|
-
- spec/lib/quandl/babelfish/data_spec.rb
|
80
64
|
- spec/lib/quandl/babelfish/date_maid_spec.rb
|
81
65
|
- spec/lib/quandl/babelfish/number_maid_spec.rb
|
82
66
|
- spec/lib/quandl/babelfish_spec.rb
|
@@ -108,7 +92,6 @@ specification_version: 4
|
|
108
92
|
summary: Quandl Data Cleaner
|
109
93
|
test_files:
|
110
94
|
- spec/lib/quandl/babelfish/cleaner_spec.rb
|
111
|
-
- spec/lib/quandl/babelfish/data_spec.rb
|
112
95
|
- spec/lib/quandl/babelfish/date_maid_spec.rb
|
113
96
|
- spec/lib/quandl/babelfish/number_maid_spec.rb
|
114
97
|
- spec/lib/quandl/babelfish_spec.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Quandl
|
2
|
-
module Babelfish
|
3
|
-
|
4
|
-
class Data < Quandl::Data
|
5
|
-
|
6
|
-
def initialize(*args)
|
7
|
-
super(*args)
|
8
|
-
# clean data on initialize
|
9
|
-
self.data_array
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
protected
|
14
|
-
|
15
|
-
def clean(data)
|
16
|
-
# skip cleaning if already clean
|
17
|
-
return data if data.kind_of?(Array) && cleaned?
|
18
|
-
# Quandl::Data is already clean, but to avoid errors extract internal array
|
19
|
-
return data.data_array if data.kind_of?(Quandl::Data)
|
20
|
-
# Return empty array if given empty string, nil, etc.
|
21
|
-
return [] if data.blank?
|
22
|
-
# Hash needs conversion to array
|
23
|
-
data = Quandl::Data::Format.hash_to_array( data )
|
24
|
-
# String needs conversion to array
|
25
|
-
data = Quandl::Data::Format.csv_to_array( data )
|
26
|
-
# Babelfish cleaner
|
27
|
-
data, self.headers = Quandl::Babelfish.clean(data)
|
28
|
-
# mark data as clean
|
29
|
-
cleaned!
|
30
|
-
# return data
|
31
|
-
data
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Quandl::Babelfish::Data do
|
4
|
-
|
5
|
-
let(:csv) { "Date, Column 1, Column 2, C3, C4, C5, C6, C7\n 2012-03-07,,69.75,69.75,69.75,0.0,0.0,0.0\n2012-03-06,69.75,69.75,69.75,69.75,0.0,0.0,0.0\n2012-03-05,69.75,69.75,69.75,69.75,0.0,0.0,0.0\n2012-03-04,69.75,69.75,69.75,69.75,0.0,0.0,0.0\n2012-02-29,,69.75,69.75,69.75,0.0,0.0,0.0\n2012-02-28,69.75,69.75,69.75,69.75,0.0,0.0,0.0\n" }
|
6
|
-
|
7
|
-
let(:data){ Quandl::Babelfish::Data.new(csv) }
|
8
|
-
subject{ data }
|
9
|
-
|
10
|
-
let(:expected_data){ [['2012-03-07',nil,69.75,69.75,69.75,0.0,0.0,0.0],['2012-03-06',69.75,69.75,69.75,69.75,0.0,0.0,0.0],['2012-03-05',69.75,69.75,69.75,69.75,0.0,0.0,0.0],['2012-03-04',69.75,69.75,69.75,69.75,0.0,0.0,0.0],['2012-02-29',nil,69.75,69.75,69.75,0.0,0.0,0.0],['2012-02-28',69.75,69.75,69.75,69.75,0.0,0.0,0.0]] }
|
11
|
-
let(:expected_headers){ ['Date', 'Column 1', 'Column 2', 'C3', 'C4', 'C5', 'C6', 'C7'] }
|
12
|
-
|
13
|
-
its(:headers){ should eq expected_headers }
|
14
|
-
its('clone.headers'){ should eq expected_headers }
|
15
|
-
its('to_jd.headers'){ should eq expected_headers }
|
16
|
-
|
17
|
-
its(:to_date_str){ should eq expected_data }
|
18
|
-
|
19
|
-
end
|