filetype_validation 0.1.2 → 0.1.3

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: 4c6578f287b418d2cdccabc34cf642f5e5eb0f9c
4
- data.tar.gz: 5e1bfcd8bbb364d0862290c014438ba661a59fc1
3
+ metadata.gz: 750c8f2c447e4ae03d43f260b9567b22d37b5aaa
4
+ data.tar.gz: 128de4a56514ebc870dbe39b8cb78533aebea4b3
5
5
  SHA512:
6
- metadata.gz: 756803e9a16fe5d26531584d6f095ed5dc1be4ea78c65130f885e1ac93c8853c550b87c950c37dcb9f2b0139dfeef2d8dc70e11cb1c2255958a37c1efcf09a16
7
- data.tar.gz: a197045fd4679828ddbb433fa67c99b0bcaf5615f4d47ffbf7f87a6a5750b532452421d4447eb0b3691ec7705abfadca51e772e3327d0e77ad43c0eb92fa0e66
6
+ metadata.gz: a71841e0b4423cefce14b91d8b39cf8590d0a73165faded3da32dac18f9c2e7cf7e3d28df1526278b0ce8533a9acf01b6875259a6f93664a851870510a73b44c
7
+ data.tar.gz: b2d55993b6e74a48878e35a3df39fe4f3f0b3056a7600ed855d9361f4c3a26282adcc4e6a5f3a44890552a39edd495ad330cb1d4e49a4a82761c2e25bc42b35d
data/README.md CHANGED
@@ -33,8 +33,8 @@ This specifies how many lines of the file the validator will use to decide wheth
33
33
  * `:headers`
34
34
  This expects either `true` or `false` to denote whether the csv file's header will be included in the validation.
35
35
 
36
- * `:skip_extension_check`
37
- If true, the gem will exclude the check for a '.csv' extension on the filepath
36
+ * `:file_extension`
37
+ If given, the gem will use this file extension instead of the one from the initialization for checking for a .csv extension. This was included in order to account for the case where files named without extensions.
38
38
 
39
39
  The gem also supports plaintext file validation:
40
40
 
@@ -18,13 +18,11 @@ module FiletypeValidation
18
18
  private
19
19
 
20
20
  # Checks if the file has a .csv extension
21
- # Check is bypassed if :skip_extension_check flag is passed
21
+ # Uses the extension given by :file_extension option, if specified
22
22
  #
23
23
  # @return [Boolean] true if the file has a csv extension
24
24
  def csv_extension?
25
- return true if options[:skip_extension_check]
26
-
27
- '.csv'.casecmp(File.extname(file.path))
25
+ '.csv'.casecmp(options[:file_extension] || File.extname(file.path))
28
26
  .zero?
29
27
  end
30
28
 
@@ -1,3 +1,3 @@
1
1
  module FiletypeValidation
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filetype_validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Jacob
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-27 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler