csv2hash 0.7.6 → 0.7.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f858ab2434cafd62ee63820a15ee7ae6b371865
4
- data.tar.gz: 908cdc6d2de35b99eb8339e715c5b0adc9e121c1
3
+ metadata.gz: 5ed42f4b0a2052336aeba56c88181120dae1feb1
4
+ data.tar.gz: e0d57bbc3a0b96864942cd0cf0532d88aca2430d
5
5
  SHA512:
6
- metadata.gz: c2b5cb6d2967d2cdc8bb72b416404154272ed326f4240c36dd4ac36b556d7ba2feb7542cb6da2b800ae0b8b0d31825aaeae526504588db11c46a6eb1cf059dbd
7
- data.tar.gz: ea9f8f336c1f6c5d111fef3728e18f4370cee7ea58075bd66e31c029f4630aeb9b072e3b4d3e18fd52a34b13dbcb00213bb2abcdddf913e70acdbc0aef80dfd4
6
+ metadata.gz: 5c111437b1a519290d1781e69069c3080152d44e0cf465bac873b05f4c2910a589223819bf9bc589f722f2e729086c6b9eef8b4eb5671a13b23be2e7dd188ce3
7
+ data.tar.gz: 82f3fd632ce057cb055a7b0ccf69d8eeb4f1153d14b2e869e6085736bb0069e7ee9f09372edd0c9f9bf43eb97813e5f958c239af3a79a5bb2316f1177e4e3b0f
@@ -1,3 +1,8 @@
1
+ ### VERSION 0.7.7
2
+
3
+ * enhancements
4
+ * prevent to pass wrong file to CSV adapter
5
+
1
6
  ### VERSION 0.7.6
2
7
 
3
8
  * bug fix
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- csv2hash (0.7.6)
4
+ csv2hash (0.7.7)
5
5
  activesupport (~> 4.1)
6
6
 
7
7
  GEM
@@ -19,6 +19,7 @@ require_relative 'csv2hash/extra_validator'
19
19
  require_relative 'csv2hash/adapters/base'
20
20
  require_relative 'csv2hash/yaml_loader'
21
21
  require_relative 'csv2hash/coercers/type_coercer'
22
+ require_relative 'csv2hash/errors'
22
23
 
23
24
  require 'csv2hash/railtie' if defined?(Rails)
24
25
 
@@ -13,9 +13,16 @@ module Csv2hash
13
13
  end
14
14
 
15
15
  def source
16
+ check_file!
16
17
  CSV.read self.file_path
17
18
  end
18
19
 
20
+ private
21
+
22
+ def check_file!
23
+ raise ::Csv2hash::InvalidFile unless File.extname(self.file_path) =~ /csv/i
24
+ end
25
+
19
26
  end
20
27
  end
21
28
  end
@@ -0,0 +1,7 @@
1
+ module Csv2hash
2
+ class InvalidFile < ArgumentError
3
+ def initialize
4
+ super("Provided file has wrong format.")
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Csv2hash
2
- VERSION = '0.7.6'
2
+ VERSION = '0.7.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv2hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel AZEMAR
@@ -126,6 +126,7 @@ files:
126
126
  - lib/csv2hash/data_wrapper.rb
127
127
  - lib/csv2hash/definition.rb
128
128
  - lib/csv2hash/discover.rb
129
+ - lib/csv2hash/errors.rb
129
130
  - lib/csv2hash/expectation.rb
130
131
  - lib/csv2hash/extra_validator.rb
131
132
  - lib/csv2hash/notifier.rb