cbhpm_table 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/cbhpm_table.rb +11 -2
- data/lib/cbhpm_table/version.rb +1 -1
- data/spec/cbhpm_table_spec.rb +5 -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: b6a10bb53622fd308b1fefaf6c6991bf211dc217
|
4
|
+
data.tar.gz: 8a912754b3612394f42ff299e9003f9552d906e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f54f0111fb5af87e3ff796cf54013ade0ff5b04355e4df5c9851afb006357fe9647e0a85219c804c527d8566b6203e61294d7b1b3b2a76cafd3fc62a9bbce69
|
7
|
+
data.tar.gz: 4b90ffeedde779a03a1699dfc5b90a4afe762f6880004849d017af76455a5cff2850398198ea9b9949db01acd89b2db7bc9f1cb6236d3c27910e1429076ce46b
|
data/README.md
CHANGED
data/lib/cbhpm_table.rb
CHANGED
@@ -3,12 +3,14 @@ require "cbhpm_table/version"
|
|
3
3
|
require 'roo'
|
4
4
|
|
5
5
|
class CBHPMTable
|
6
|
-
attr_reader :roo, :headers_hash
|
6
|
+
attr_reader :roo, :headers_hash, :edition_name
|
7
7
|
|
8
8
|
def initialize(cbhpm_path, headers_hash = nil)
|
9
9
|
cbhpm_file_extension = File.extname(cbhpm_path)
|
10
10
|
cbhpm_file_basename = File.basename(cbhpm_path)
|
11
11
|
|
12
|
+
@edition_name = EDITION_NAME_FOR_FILE[cbhpm_file_basename]
|
13
|
+
|
12
14
|
roo_class = ROO_CLASS_FOR_EXTENSION[cbhpm_file_extension]
|
13
15
|
@roo = roo_class.new(cbhpm_path)
|
14
16
|
@headers_hash = headers_hash || HEADER_FOR_FILE[cbhpm_file_basename]
|
@@ -83,7 +85,14 @@ class CBHPMTable
|
|
83
85
|
HEADER_FOR_FILE =
|
84
86
|
{ "CBHPM 5¶ Ediá∆o.xls" => HeaderFormat::CBHPM5a,
|
85
87
|
"CBHPM 2010 separada.xls" => HeaderFormat::CBHPM2010,
|
86
|
-
"CBHPM 2012.xlsx" => HeaderFormat::CBHPM2012
|
88
|
+
"CBHPM 2012.xlsx" => HeaderFormat::CBHPM2012,
|
89
|
+
"cbhpm_cut_for_testing.xlsx" => HeaderFormat::CBHPM2012 }
|
90
|
+
|
91
|
+
EDITION_NAME_FOR_FILE =
|
92
|
+
{ "CBHPM 5¶ Ediá∆o.xls" => "5a",
|
93
|
+
"CBHPM 2010 separada.xls" => "2010",
|
94
|
+
"CBHPM 2012.xlsx" => "2012",
|
95
|
+
"cbhpm_cut_for_testing.xlsx" => "2012" }
|
87
96
|
|
88
97
|
ROO_CLASS_FOR_EXTENSION = { ".xls" => Roo::Excel, ".xlsx" => Roo::Excelx }
|
89
98
|
end
|
data/lib/cbhpm_table/version.rb
CHANGED
data/spec/cbhpm_table_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'cbhpm_table'
|
|
3
3
|
|
4
4
|
describe CBHPMTable do
|
5
5
|
let(:cbhpm_table) do
|
6
|
-
CBHPMTable.new("spec/cbhpm/
|
6
|
+
CBHPMTable.new("spec/cbhpm/cbhpm_cut_for_testing.xlsx",
|
7
7
|
CBHPMTable::HeaderFormat::CBHPM2012)
|
8
8
|
end
|
9
9
|
|
@@ -59,5 +59,9 @@ describe CBHPMTable do
|
|
59
59
|
it { expect(rows.first).to be_instance_of Hash }
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
describe "#edition_name" do
|
64
|
+
it { expect(cbhpm_table.edition_name).to eq "2012" }
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|