bank_statement_parser 0.1.5 → 0.1.6

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: 56d910159a40e7a8683e52c48844705efca7795b
4
- data.tar.gz: f569db6c623039c8151e29055437216b024cfdf7
3
+ metadata.gz: eadc44360fee1352ac3d3a6149611a1a1d9b731a
4
+ data.tar.gz: b558b77ded2d18b8a190adf1f562db639a8090d6
5
5
  SHA512:
6
- metadata.gz: 48c59ff09a3302c61e077d60215c26b38517aad25ad428b96edcbfe7e38e5750b88d6c08948e16ce481feed967f066b36d69375be87fa0ce2cf43985bb928f3a
7
- data.tar.gz: 4a62e039f1b37fdfc15932c24328723ca52b4fa1e6b10b7b85d0090dbd8e422aa5c4c4309aa20f917831ba373acea2db6188733faf26e2d812388b8964544620
6
+ metadata.gz: 657789fbe5261e86c51677ab120f088819d69598661d39a03ab7933f2cb77f2981661360502b3ca9676f2b919325f6b275b8ded28ad2c56ecfe41eeaba70a9ac
7
+ data.tar.gz: b18377ab3de2030c0cf13025be9cc5d73f962ca87d8e6598c3eb9d2fdc8286051cbdb4dc8ed9d230b94b0761d56e036308acae69c4339b9f3b7aba20525a064c
@@ -15,6 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with bank_statement_parser. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
+ require 'open-uri'
18
19
  require 'bank_statement_parser/bank_statement'
19
20
 
20
21
  module BankStatementParser
@@ -42,12 +43,16 @@ module BankStatementParser
42
43
 
43
44
  # Parse the specified text file
44
45
  def parse path
45
- raise "Expected a text file path" unless path =~ /\.txt\z/
46
-
47
46
  reset
48
47
 
49
- # Grab the full text file content (utf-8)
50
- full_text = File.read(path)
48
+ # Is the path a URI?
49
+ full_text = if path =~ URI::regexp(%w(ftp http https))
50
+ open(path).read
51
+ else
52
+ raise "Expected a text file path" unless path =~ /\.txt\z/
53
+ # Grab the full text file content (utf-8)
54
+ read(path)
55
+ end
51
56
 
52
57
  # Process each line in turn
53
58
  full_text.split("\n").each do |line|
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Dawson
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - pdftotext(1)
63
63
  rubyforge_project:
64
- rubygems_version: 2.2.2
64
+ rubygems_version: 2.4.5
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: Bank statement parser