quandl_babelfish 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/UPGRADE.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.0.9
2
+
3
+ * QUGC-54 write failing spec for input with nil row value
4
+
5
+
1
6
  ## 0.0.8
2
7
 
3
8
  * QUGC-42 you should not have to include data; you might just want to update headers
@@ -21,11 +21,13 @@ class Cleaner
21
21
  NumberMaid::init(number_settings)
22
22
  dirty_array.each.with_index do |row, i|
23
23
  new_row=[]
24
- (new_row << clean_dates[i]).concat Array(NumberMaid::clean(row[1..-1])) #add clean date and all clean numbers
24
+ clean_row=NumberMaid::clean(row[1..-1])
25
+ clean_row=[nil] if clean_row.nil?
26
+ (new_row << clean_dates[i]).concat Array(clean_row) #add clean date and all clean numbers
25
27
  clean_array << new_row
26
28
  end
27
29
 
28
- return Helper::make_square(clean_array), header
30
+ return clean_array, header
29
31
  end
30
32
  end
31
33
  end
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Babelfish
3
- VERSION = '0.0.8'
3
+ VERSION = '0.0.9'
4
4
  end
5
5
  end
@@ -9,6 +9,16 @@ describe Cleaner do
9
9
  let(:headers){ output[1] }
10
10
  subject{ data }
11
11
 
12
+ context "given nil" do
13
+ let(:input){ [[2012, nil], [2011, 20], [2010, 30]] }
14
+ it{ should eq [[Date.new(2012,12,31), nil], [Date.new(2011,12,31), 20.0], [Date.new(2010,12,31), 30.0]] }
15
+ end
16
+
17
+ context "mismatch row count" do
18
+ let(:input){ [[2012], [2011, 20], [2010, 30, 25]] }
19
+ it{ should eq [[Date.new(2012,12,31)], [Date.new(2011,12,31), 20], [Date.new(2010,12,31), 30, 25]] }
20
+ end
21
+
12
22
  context "garbage" do
13
23
  let(:input){ [[2456624, 10], [2456625, 20], [2456626, 30]] }
14
24
  it{ should be_eq_at_index '[0][0]', Date.new(1970,01,29) }
@@ -49,7 +59,7 @@ describe Cleaner do
49
59
  context "data with nil" do
50
60
  let(:input){ [["Date", "Col1"], ["2002", nil], ["2003", "5"]] }
51
61
  it{ should be_eq_at_index '[0][0]', Date.new(2002,12,31) }
52
- it{ data[0].length.should ==2}
62
+ it{ data[0].length.should == 2}
53
63
  it{ should be_eq_at_index '[0][1]', nil }
54
64
  it{ should be_eq_at_index '[1][0]', Date.new(2003,12,31) }
55
65
  it{ should be_eq_at_index '[1][1]', 5 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_babelfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-31 00:00:00.000000000 Z
12
+ date: 2014-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec