bankocr 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51e9f6ed181fb6340334fb1d1aab02b63fef8ba1
4
- data.tar.gz: 63b85e8d8dc37b40d8ff16bfde34cf6457276854
3
+ metadata.gz: 722d178bd4372da2e4cec0c87c005a617b396bb0
4
+ data.tar.gz: eb2ed4d90d0837e247f1fc5eef8b256eecf4356d
5
5
  SHA512:
6
- metadata.gz: 52eb966fadec59720b6d2474dbffc5be72a784d4cdc701fbe62c45f1df28bc8f7c7336002f2d710b993d309b77d8b7035e1345e79995995792d5cf0644f147b4
7
- data.tar.gz: 29b79b21203e50fce61e8c297efac31ae5c87868b03f45138358539c4578a84f7bd2ddb4d356631be1ffb003acc1819bd0c60381cdac25991a78bbe6e10b8f2d
6
+ metadata.gz: 1daa5a1d719c3a28941013a1185d6c76f1ef737afeee208705c3b83f539c8a9473f80f7e6dbe7bf7aa8812b6de4a512d7ccd5d70bec36119e267cabdaf345c59
7
+ data.tar.gz: a106a880bb7cf204ba731794be2295c936f1a4380809049bb7a65db2433d4421d6c78dbb7d4e614c405fcbf0ffacc8e1540a80730add2ae97ba2df1ca1138bcc
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rspec', '~> 3.0.0'
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,3 +1,8 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bankocr (0.0.1)
5
+
1
6
  GEM
2
7
  remote: https://rubygems.org/
3
8
  specs:
@@ -19,4 +24,6 @@ PLATFORMS
19
24
  ruby
20
25
 
21
26
  DEPENDENCIES
22
- rspec (~> 3.0.0)
27
+ bankocr!
28
+ bundler (~> 1.6)
29
+ rspec (~> 3.0)
data/bankocr.gemspec CHANGED
@@ -4,20 +4,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'bankocr/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "bankocr"
7
+ spec.name = 'bankocr'
8
8
  spec.version = BankOCR::VERSION
9
- spec.authors = ["Javier Cervantes"]
10
- spec.email = ["javier@hybridgroup.com"]
11
- spec.summary = %q{Solution to BankOCR Kata}
12
- spec.description = %q{Solution in ruby of BankOCR Kata: http://code.joejag.com/coding-dojo-bank-ocr/}
13
- spec.homepage = "https://github.com/solojavier/bankOCR"
14
- spec.license = "MIT"
9
+ spec.authors = ['Javier Cervantes']
10
+ spec.email = ['1.27201@gmail.com']
11
+ spec.summary = %w(Solution to BankOCR Kata)
12
+ spec.description = %w(Solution in ruby of BankOCR Kata: http://code.joejag.com/coding-dojo-bank-ocr/)
13
+ spec.homepage = 'https://github.com/solojavier/bankOCR'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
17
+ spec.executables = ['bankocr']
18
+ spec.test_files = spec.files.grep(/^(test|spec|features)/)
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.6"
22
- spec.add_development_dependency "rspec", "~> 3.0"
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rspec', '~> 3.0'
23
23
  end
@@ -1,6 +1,6 @@
1
1
  module BankOCR
2
+ # Object representing an account number
2
3
  class AccountNumber
3
-
4
4
  attr_reader :error_message, :digits
5
5
 
6
6
  def initialize(digits)
@@ -26,6 +26,5 @@ module BankOCR
26
26
  def sum(account_number)
27
27
  (0..8).map { |i| account_number[i].to_i * (i + 2) }.reduce(:+)
28
28
  end
29
-
30
29
  end
31
30
  end
data/lib/bankocr.rb CHANGED
@@ -1,5 +1,7 @@
1
- require "bankocr/version"
1
+ require 'bankocr/version'
2
2
 
3
+ # Module with logic to process a OCR input file
4
+ # and export a report with account numbers
3
5
  module BankOCR
4
6
  autoload :FileParser, 'file_parser'
5
7
  autoload :AccountNumber, 'account_number'
@@ -1,3 +1,3 @@
1
1
  module BankOCR
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/file_parser.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module BankOCR
2
+ # Reads a file from OCR and converts to digits
2
3
  class FileParser
3
-
4
4
  def initialize(input_path)
5
5
  @input_path = input_path
6
6
  end
@@ -54,6 +54,5 @@ module BankOCR
54
54
  ' _ |_||_|' => '8',
55
55
  ' _ |_| _|' => '9' }
56
56
  end
57
-
58
57
  end
59
58
  end
@@ -1,6 +1,6 @@
1
1
  module BankOCR
2
+ # Creates a text file with generated report
2
3
  class ReportGenerator
3
-
4
4
  def initialize(output_path, account_numbers)
5
5
  @output_path = output_path
6
6
  @account_numbers = account_numbers
@@ -11,12 +11,11 @@ module BankOCR
11
11
 
12
12
  @account_numbers.each do |account|
13
13
  file.write account.digits
14
- file.write " #{account.error_message}" if !account.valid?
14
+ file.write " #{account.error_message}" unless account.valid?
15
15
  file.write "\n"
16
16
  end
17
17
 
18
18
  file.close
19
19
  end
20
-
21
20
  end
22
21
  end
@@ -12,7 +12,7 @@ describe 'Application execution' do
12
12
  end
13
13
 
14
14
  before do
15
- File.delete(output) if File.exists?(output)
15
+ File.delete(output) if File.exist?(output)
16
16
  end
17
17
 
18
18
  it 'parses file and creates report', integration: true do
@@ -9,7 +9,7 @@ describe BankOCR::AccountNumber do
9
9
  let(:wrong_numbers) { %w(86110?356) }
10
10
 
11
11
  let(:wrong_accounts) do
12
- [ { account_number: '86110??36', valid: false, message: 'ILL' } ]
12
+ [{ account_number: '86110??36', valid: false, message: 'ILL' }]
13
13
  end
14
14
 
15
15
  it 'validates valid account numbers' do
@@ -21,7 +21,7 @@ describe BankOCR::ReportGenerator do
21
21
  end
22
22
 
23
23
  before do
24
- File.delete(output_path) if File.exists?(output_path)
24
+ File.delete(output_path) if File.exist?(output_path)
25
25
  end
26
26
 
27
27
  it 'creates empty file if accounts are not sent' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bankocr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Cervantes
@@ -38,12 +38,11 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
- description: 'Solution in ruby of BankOCR Kata: http://code.joejag.com/coding-dojo-bank-ocr/'
41
+ description: '["Solution", "in", "ruby", "of", "BankOCR", "Kata:", "http://code.joejag.com/coding-dojo-bank-ocr/"]'
42
42
  email:
43
- - javier@hybridgroup.com
43
+ - 1.27201@gmail.com
44
44
  executables:
45
45
  - bankocr
46
- - input.in
47
46
  extensions: []
48
47
  extra_rdoc_files: []
49
48
  files:
@@ -91,7 +90,7 @@ rubyforge_project:
91
90
  rubygems_version: 2.2.2
92
91
  signing_key:
93
92
  specification_version: 4
94
- summary: Solution to BankOCR Kata
93
+ summary: '["Solution", "to", "BankOCR", "Kata"]'
95
94
  test_files:
96
95
  - spec/bin/bankocr_spec.rb
97
96
  - spec/bin/input.in