bank_statement_parser 0.1.6 → 0.1.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 +4 -4
- data/lib/bank_statement_parser/base.rb +14 -6
- 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: 37ee2ac920576bbe217ac77bfe484c3368836224
|
4
|
+
data.tar.gz: 8aa389de7d09ecc862cd2a9cbb3614b54f966e7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c928c9252f3827bc8a5a8d21a8667b29bfc4faf90f57e6fde52d4690a2b36da927dd02217d2e6c3d59d80f0c21d3f8355a3406156dae33a08906d87ff04d1302
|
7
|
+
data.tar.gz: 58c84aa000de9fbd8f9abb15b69fa06d469e5b1bf598a6b2ec7c94fb51f4c75f93a96547208b11b5ae38e538e0b3200196d4bf2ff372af457c9915349f0a4147
|
@@ -45,13 +45,21 @@ module BankStatementParser
|
|
45
45
|
def parse path
|
46
46
|
reset
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
full_text = case path
|
49
|
+
when String
|
50
|
+
# Is the path a URI?
|
51
|
+
if path =~ URI::regexp(%w(ftp http https))
|
52
|
+
open(path).read
|
53
|
+
else
|
54
|
+
raise "Expected a text file path" unless
|
55
|
+
path =~ /\.txt\z/
|
56
|
+
# Grab the full text file content (utf-8)
|
57
|
+
read(path)
|
58
|
+
end
|
59
|
+
when IO, Pathname, URI
|
60
|
+
path.read
|
51
61
|
else
|
52
|
-
raise "Expected
|
53
|
-
# Grab the full text file content (utf-8)
|
54
|
-
read(path)
|
62
|
+
raise ArgumentError, "Expected String, IO, Pathname or URI"
|
55
63
|
end
|
56
64
|
|
57
65
|
# Process each line in turn
|