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 +4 -4
- data/README.md +2 -2
- data/lib/filetype_validation/csv_validator.rb +2 -4
- data/lib/filetype_validation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 750c8f2c447e4ae03d43f260b9567b22d37b5aaa
|
4
|
+
data.tar.gz: 128de4a56514ebc870dbe39b8cb78533aebea4b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
* `:
|
37
|
-
If
|
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
|
-
#
|
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
|
-
|
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
|
|
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.
|
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-
|
11
|
+
date: 2016-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|