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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eadc44360fee1352ac3d3a6149611a1a1d9b731a
4
- data.tar.gz: b558b77ded2d18b8a190adf1f562db639a8090d6
3
+ metadata.gz: 37ee2ac920576bbe217ac77bfe484c3368836224
4
+ data.tar.gz: 8aa389de7d09ecc862cd2a9cbb3614b54f966e7c
5
5
  SHA512:
6
- metadata.gz: 657789fbe5261e86c51677ab120f088819d69598661d39a03ab7933f2cb77f2981661360502b3ca9676f2b919325f6b275b8ded28ad2c56ecfe41eeaba70a9ac
7
- data.tar.gz: b18377ab3de2030c0cf13025be9cc5d73f962ca87d8e6598c3eb9d2fdc8286051cbdb4dc8ed9d230b94b0761d56e036308acae69c4339b9f3b7aba20525a064c
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
- # Is the path a URI?
49
- full_text = if path =~ URI::regexp(%w(ftp http https))
50
- open(path).read
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 a text file path" unless path =~ /\.txt\z/
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bank_statement_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Dawson