bai_parser 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +3 -0
- data/lib/bai_parser.rb +11 -4
- data/lib/bai_parser/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZGI2MzNjMDRiMTI4YWZhY2NmMDA3YzYyMjA2MWZmNDdiMTE5ODFiNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YWYzYzBhNWQ5NzZlYjBkMDJiYzFiMmRhOWUyMmM5NGU0ZjYzZjA4Zg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NzA4M2QzMjc0MDY1MjY4MzllOGVmYWQ2NTUyMzg3OGE1YTg1NmM0Y2I2Y2Fh
|
10
|
+
MTQ3NzNjZjZkY2Q1OWE2NmUxZWI0NGU4ZmJkYzk2ZmIyNjFlYjRkYjIyNTZl
|
11
|
+
NjhkNTAwZWMxMWNkZDE3ZTRlNzgwNWY3NWEzMGVlZjhlMjliYTY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
N2Q2YzU4MGQ3Zjc4YmM2MjI1MzVhN2E2MDIyMThiMTRhZWRmNmM1NTA3ODhm
|
14
|
+
YmJkZmZiMDc2YTVkMGE5NTdkMGIwYzZjNjQ4YjU0YWYyMzk4NjFlMzY4OGVk
|
15
|
+
NzZjMTgzMDRmZjkzMDliODlmZTg2ZGQyYjBhZTI5M2ZkZmJiOWM=
|
data/README.md
CHANGED
@@ -21,6 +21,8 @@ Or install it yourself as:
|
|
21
21
|
``` ruby
|
22
22
|
require "bai_parser"
|
23
23
|
data = BaiParser::Parser.parse "BAI-File-From-Bank.bai"
|
24
|
+
# or
|
25
|
+
data = BaiParser::Parser.parse file_contents_from_bai_file
|
24
26
|
|
25
27
|
# Then you can use a custom writer to output the data as needed such as to a csv file
|
26
28
|
MyCustomBAIWriter.write data
|
@@ -36,3 +38,4 @@ bai_parse bai-file.txt
|
|
36
38
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
39
|
4. Push to the branch (`git push origin my-new-feature`)
|
38
40
|
5. Create new Pull Request
|
41
|
+
|
data/lib/bai_parser.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "bai_parser/version"
|
2
|
+
require 'stringio'
|
2
3
|
|
3
4
|
module BaiParser
|
4
5
|
|
@@ -26,13 +27,19 @@ module BaiParser
|
|
26
27
|
@data = {}
|
27
28
|
end
|
28
29
|
|
29
|
-
def self.parse(
|
30
|
+
def self.parse(filename_or_file_contents)
|
30
31
|
p = self.new
|
31
|
-
p.parse
|
32
|
+
p.parse filename_or_file_contents
|
32
33
|
end
|
33
34
|
|
34
|
-
def parse(
|
35
|
-
|
35
|
+
def parse(filename_or_file_contents)
|
36
|
+
if File.file? filename_or_file_contents
|
37
|
+
f = File.open(filename_or_file_contents)
|
38
|
+
elsif filename_or_file_contents =~ /^01,/
|
39
|
+
f = StringIO.new(filename_or_file_contents)
|
40
|
+
else
|
41
|
+
raise ArgumentError, "Did not provide valid BAI data (does not start with 01 File Header record) or valid file name"
|
42
|
+
end
|
36
43
|
record = next_line = f.gets.chomp
|
37
44
|
count = 1
|
38
45
|
loop do
|
data/lib/bai_parser/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bai_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sanjiv Patel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Ruby BAI2 Bank File parser
|
@@ -46,7 +46,7 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
-
|
49
|
+
- .gitignore
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
@@ -65,19 +65,20 @@ require_paths:
|
|
65
65
|
- lib
|
66
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.2.
|
78
|
+
rubygems_version: 2.2.1
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Takes a bank file as input and outputs the data as a Ruby hash. You can
|
82
82
|
then use a custom writer class to output the data as needed for your purposes.
|
83
83
|
test_files: []
|
84
|
+
has_rdoc:
|