quandl_babelfish 0.0.2
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 +7 -0
- data/.gitignore +7 -0
- data/.travis.yml +12 -0
- data/Gemfile +2 -0
- data/LICENSE +7 -0
- data/README.md +18 -0
- data/UPGRADE.md +6 -0
- data/lib/quandl/babelfish/cleaner.rb +33 -0
- data/lib/quandl/babelfish/data.rb +22 -0
- data/lib/quandl/babelfish/date_maid.rb +238 -0
- data/lib/quandl/babelfish/number_maid.rb +80 -0
- data/lib/quandl/babelfish/version.rb +5 -0
- data/lib/quandl/babelfish.rb +22 -0
- data/lib/quandl/error/guess_date_format.rb +6 -0
- data/lib/quandl/error/invalid_date.rb +6 -0
- data/lib/quandl/error/unknown_date_format.rb +6 -0
- data/quandl_babelfish.gemspec +21 -0
- data/spec/lib/quandl/babelfish/cleaner_spec.rb +47 -0
- data/spec/lib/quandl/babelfish/data_spec.rb +33 -0
- data/spec/lib/quandl/babelfish/date_maid_spec.rb +529 -0
- data/spec/lib/quandl/babelfish/number_maid_spec.rb +126 -0
- data/spec/lib/quandl/babelfish_spec.rb +15 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/support/matchers/be_eq_at_index.rb +32 -0
- metadata +102 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
RSpec::Matchers.define :be_eq_at_index do |index, expected|
|
2
|
+
match do |actual|
|
3
|
+
# value should eq expectation
|
4
|
+
actual_value_with_index(actual, index) == expected
|
5
|
+
end
|
6
|
+
|
7
|
+
failure_message_for_should do |actual|
|
8
|
+
"expected that #{actual_value_with_index(actual, index)} would eq #{expected}"
|
9
|
+
end
|
10
|
+
|
11
|
+
failure_message_for_should_not do |actual|
|
12
|
+
"expected that #{actual_value_with_index(actual, index)} would eq #{expected}"
|
13
|
+
end
|
14
|
+
|
15
|
+
description do
|
16
|
+
"be eq to #{expected} for array at index #{index}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def actual_value_with_index(actual, index)
|
20
|
+
# split string index into keys
|
21
|
+
indexes = index.to_s.split(']').collect{|v| v.gsub('[','') }
|
22
|
+
# convert indexes to integers if this is an array
|
23
|
+
indexes = indexes.collect(&:to_i) if actual.is_a?(Array)
|
24
|
+
# apply indexes to value
|
25
|
+
value = actual
|
26
|
+
indexes.each do |i|
|
27
|
+
value = value.send(:[], i)
|
28
|
+
end
|
29
|
+
value
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: quandl_babelfish
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergei Ryshkevich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Quandl Data Cleaner
|
42
|
+
email:
|
43
|
+
- sergei@quandl.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .travis.yml
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- UPGRADE.md
|
54
|
+
- lib/quandl/babelfish.rb
|
55
|
+
- lib/quandl/babelfish/cleaner.rb
|
56
|
+
- lib/quandl/babelfish/data.rb
|
57
|
+
- lib/quandl/babelfish/date_maid.rb
|
58
|
+
- lib/quandl/babelfish/number_maid.rb
|
59
|
+
- lib/quandl/babelfish/version.rb
|
60
|
+
- lib/quandl/error/guess_date_format.rb
|
61
|
+
- lib/quandl/error/invalid_date.rb
|
62
|
+
- lib/quandl/error/unknown_date_format.rb
|
63
|
+
- quandl_babelfish.gemspec
|
64
|
+
- spec/lib/quandl/babelfish/cleaner_spec.rb
|
65
|
+
- spec/lib/quandl/babelfish/data_spec.rb
|
66
|
+
- spec/lib/quandl/babelfish/date_maid_spec.rb
|
67
|
+
- spec/lib/quandl/babelfish/number_maid_spec.rb
|
68
|
+
- spec/lib/quandl/babelfish_spec.rb
|
69
|
+
- spec/spec_helper.rb
|
70
|
+
- spec/support/matchers/be_eq_at_index.rb
|
71
|
+
homepage: http://quandl.com/
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.1.10
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Quandl Data Cleaner
|
95
|
+
test_files:
|
96
|
+
- spec/lib/quandl/babelfish/cleaner_spec.rb
|
97
|
+
- spec/lib/quandl/babelfish/data_spec.rb
|
98
|
+
- spec/lib/quandl/babelfish/date_maid_spec.rb
|
99
|
+
- spec/lib/quandl/babelfish/number_maid_spec.rb
|
100
|
+
- spec/lib/quandl/babelfish_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
- spec/support/matchers/be_eq_at_index.rb
|