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 CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3d34da874690f58f48f39195665de60c585ed98b
4
- data.tar.gz: 1a2e5c50afe663db810e539adcbddd35cea4d5e4
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGI2MzNjMDRiMTI4YWZhY2NmMDA3YzYyMjA2MWZmNDdiMTE5ODFiNg==
5
+ data.tar.gz: !binary |-
6
+ YWYzYzBhNWQ5NzZlYjBkMDJiYzFiMmRhOWUyMmM5NGU0ZjYzZjA4Zg==
5
7
  SHA512:
6
- metadata.gz: 316c1abab2effbe551103b1410384799a183cbc8f01a62fd1f677165b03ff1549a7276c289ac639da60b9d37f924b4aae65b7ad4d92e0dec9e71f02f6b259908
7
- data.tar.gz: 0ecc9956c2156d6c1bfaa65497515577edd276bad9743aed3644bad1c1462c9dcc9ebe5ec38a05ee28c46fe0c8de8962990d9860c8adeab0b2d87b7814a41476
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
+
@@ -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(filename)
30
+ def self.parse(filename_or_file_contents)
30
31
  p = self.new
31
- p.parse filename
32
+ p.parse filename_or_file_contents
32
33
  end
33
34
 
34
- def parse(filename)
35
- f = File.open(filename)
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
@@ -1,3 +1,3 @@
1
1
  module BaiParser
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
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.2
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-01-29 00:00:00.000000000 Z
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
- - ".gitignore"
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.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: