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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2665ab80eeac088dfe2d6d672bd8360d6e80fb2a
4
- data.tar.gz: b5abeb212cef6adc12891bcab5d1fd9690ae0980
3
+ metadata.gz: b6a10bb53622fd308b1fefaf6c6991bf211dc217
4
+ data.tar.gz: 8a912754b3612394f42ff299e9003f9552d906e6
5
5
  SHA512:
6
- metadata.gz: 698385dfea783bb86373d1deaca68755a7181c3692359351543dc354b7d30793c13269274d38acf7ad757f08c3ca147a9d7ff9291f8b73e5ba1c0b0876bb1320
7
- data.tar.gz: 8963d7e4abc34600d20bf6ee25f2407d2613868a0e514a3dbbc5fdfc25be94ab12f14866d38b0658d5b6aa98b97b7b50f98d0bdfac40e95efe64878af4102b1a
6
+ metadata.gz: 1f54f0111fb5af87e3ff796cf54013ade0ff5b04355e4df5c9851afb006357fe9647e0a85219c804c527d8566b6203e61294d7b1b3b2a76cafd3fc62a9bbce69
7
+ data.tar.gz: 4b90ffeedde779a03a1699dfc5b90a4afe762f6880004849d017af76455a5cff2850398198ea9b9949db01acd89b2db7bc9f1cb6236d3c27910e1429076ce46b
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/cbhpm_table.svg)](http://badge.fury.io/rb/cbhpm_table)
2
+
1
3
  # CBHPMTable
2
4
 
3
5
  A simple gem to wrap the CBHPM excel files from Associação Brasileira de Medicina.
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
@@ -1,3 +1,3 @@
1
1
  class CBHPMTable
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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/CBHPM_cut_for_testing.xlsx",
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbhpm_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abinoam Praxedes Marques Jr.