banktools-global 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 003d61bea3f19fb30ece532474b46e3fdf2f8bb69b44b58ad091d5bbab8438e7
4
- data.tar.gz: f2063c18c11fd5b7bac3036156849cb9fe85bb15262b6458816abf71e2cc0dc5
3
+ metadata.gz: 2f967b8f0b0bdaf9d08b043b27263f0824ab6c8b51e9b32a7880a3e9a7c3127d
4
+ data.tar.gz: a684c3960db386810020bcffc58a435c06f9509e62dd9463abaacb18d5b95bf9
5
5
  SHA512:
6
- metadata.gz: 81bff04af82a6647241e4a9b34c0af52645533aac48c1c891bff9e46ae60891729f7ed63bfcccf5861929c60d4be89da9a5167dd5955b31cb0ccc2175aa5624d
7
- data.tar.gz: b3a0060d26cfdc78899ab7d5bc366e9574b725b50b6583adabe5cf17f01e5b5e097ba0ea2c5b9ae222e1b878b597a4c10d50b96e5247b914d11406698e1f2795
6
+ metadata.gz: 38343b5d0a7470536849a9cb59dea203d1352b535f7efffda9f9e63f06aab570875b03dc5c3835500b9fb0dc0ff257652ef895322cff18ed25ab84bad82850a1
7
+ data.tar.gz: 065fae49bcd7bdebed65a629b2580dc4c3c9becab6213466547c3b123859b0a85c16f2fd18caee65cc4dd25432a4cb54867f2d614de9c169161d3f75df1b069e
@@ -1,18 +1,21 @@
1
1
  name: Ruby
2
2
 
3
- on: [push,pull_request]
3
+ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby-version: ["3.0", "2.7"]
12
+
8
13
  steps:
9
14
  - uses: actions/checkout@v2
10
- - name: Set up Ruby
15
+ - name: Set up Ruby ${{ matrix.ruby-version }}
11
16
  uses: ruby/setup-ruby@v1
12
17
  with:
13
- ruby-version: 2.7.2
14
- - name: Run the default task
15
- run: |
16
- gem install bundler -v 2.2.14
17
- bundle install
18
- bundle exec rake
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
20
+ - name: Run tests
21
+ run: bundle exec rake
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "tmp/**/*"
4
+ inherit_gem:
5
+ barsoom_utils: shared_rubocop.yml
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## [Unreleased]
2
2
 
3
+ - Safer YAML loading
4
+
3
5
  ## [1.0.1] - 2021-04-19
4
6
 
5
7
  - Bugfix: Allow spaces in IBAN.
data/Gemfile CHANGED
@@ -8,3 +8,8 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "rspec", "~> 3.0"
11
+
12
+ group :development, :test do
13
+ gem "barsoom_utils", github: "barsoom/barsoom_utils"
14
+ gem "rubocop"
15
+ end
data/Gemfile.lock CHANGED
@@ -1,13 +1,26 @@
1
+ GIT
2
+ remote: https://github.com/barsoom/barsoom_utils.git
3
+ revision: d59121c10b4ba0e996d213ad23dc1545dcd27de0
4
+ specs:
5
+ barsoom_utils (0.1.0)
6
+
1
7
  PATH
2
8
  remote: .
3
9
  specs:
4
- banktools-global (0.1.0)
10
+ banktools-global (1.0.1)
5
11
 
6
12
  GEM
7
13
  remote: https://rubygems.org/
8
14
  specs:
15
+ ast (2.4.2)
9
16
  diff-lcs (1.4.4)
10
- rake (13.0.3)
17
+ parallel (1.20.1)
18
+ parser (3.0.2.0)
19
+ ast (~> 2.4.1)
20
+ rainbow (3.0.0)
21
+ rake (13.0.6)
22
+ regexp_parser (2.1.1)
23
+ rexml (3.2.5)
11
24
  rspec (3.10.0)
12
25
  rspec-core (~> 3.10.0)
13
26
  rspec-expectations (~> 3.10.0)
@@ -21,14 +34,30 @@ GEM
21
34
  diff-lcs (>= 1.2.0, < 2.0)
22
35
  rspec-support (~> 3.10.0)
23
36
  rspec-support (3.10.2)
37
+ rubocop (1.18.4)
38
+ parallel (~> 1.10)
39
+ parser (>= 3.0.0.0)
40
+ rainbow (>= 2.2.2, < 4.0)
41
+ regexp_parser (>= 1.8, < 3.0)
42
+ rexml
43
+ rubocop-ast (>= 1.8.0, < 2.0)
44
+ ruby-progressbar (~> 1.7)
45
+ unicode-display_width (>= 1.4.0, < 3.0)
46
+ rubocop-ast (1.8.0)
47
+ parser (>= 3.0.1.1)
48
+ ruby-progressbar (1.11.0)
49
+ unicode-display_width (2.0.0)
24
50
 
25
51
  PLATFORMS
26
52
  x86_64-darwin-20
53
+ x86_64-linux
27
54
 
28
55
  DEPENDENCIES
29
56
  banktools-global!
57
+ barsoom_utils!
30
58
  rake (~> 13.0)
31
59
  rspec (~> 3.0)
60
+ rubocop
32
61
 
33
62
  BUNDLED WITH
34
- 2.2.14
63
+ 2.2.25
@@ -5,30 +5,21 @@ require_relative "lib/banktools/global/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "banktools-global"
7
7
  spec.version = BankTools::Global::VERSION
8
- spec.authors = ["Henrik Nyh"]
9
- spec.email = ["henrik@nyh.se"]
8
+ spec.authors = [ "Henrik Nyh" ]
9
+ spec.email = [ "henrik@nyh.se" ]
10
10
 
11
11
  spec.summary = "Validate and normalize international bank account numbers like IBAN/BIC. Based on iban-tools."
12
12
  spec.homepage = "https://github.com/barsoom/banktools-global"
13
13
  spec.license = "MIT"
14
14
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
15
+ spec.metadata = { "rubygems_mfa_required" => "true" }
15
16
 
16
17
  spec.metadata["homepage_uri"] = spec.homepage
17
18
  spec.metadata["source_code_uri"] = spec.homepage
18
- spec.metadata["changelog_uri"] = "https://github.com/barsoom/banktools-global/blob/master/README.md"
19
+ spec.metadata["changelog_uri"] = "https://github.com/barsoom/banktools-global/blob/main/README.md"
19
20
 
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
21
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
23
  end
25
- spec.bindir = "exe"
26
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
- spec.require_paths = ["lib"]
28
-
29
- # Uncomment to register a new dependency of your gem
30
- # spec.add_dependency "example-gem", "~> 1.0"
31
-
32
- # For more information and examples about making a new gem, checkout our
33
- # guide at: https://bundler.io/guides/creating_gem.html
24
+ spec.require_paths = [ "lib" ]
34
25
  end
@@ -7,7 +7,7 @@ class BankTools::Global::IBAN
7
7
  E = BankTools::Global::Errors
8
8
 
9
9
  def initialize(raw)
10
- @pre_normalized = raw.to_s.gsub(/\s/, "").strip.upcase
10
+ @pre_normalized = raw.to_s.gsub(/\s/, "").upcase
11
11
  end
12
12
 
13
13
  def valid?
@@ -30,22 +30,22 @@ class BankTools::Global::IBAN
30
30
  end
31
31
 
32
32
  def normalize
33
- @pre_normalized.gsub(/.{4}/, '\0 ').strip
33
+ @pre_normalized.gsub(/.{4}/, '\0 ').strip
34
34
  end
35
35
 
36
36
  private
37
37
 
38
38
  def good_checksum?
39
- number_string =
39
+ number =
40
40
  (bban + country_code + check_digits).chars.map { |char|
41
41
  case char
42
42
  when "0".."9" then char
43
43
  when "A".."Z" then (char.ord - 55).to_s
44
44
  else raise "Unexpected byte '#{byte}' in IBAN '#{normalize}'!"
45
45
  end
46
- }.join
46
+ }.join.to_i
47
47
 
48
- number_string.to_i % 97 == 1
48
+ number % 97 == 1
49
49
  end
50
50
 
51
51
  def country_code
@@ -62,7 +62,7 @@ class BankTools::Global::IBAN
62
62
 
63
63
  def rules
64
64
  @@rules ||=
65
- YAML.load(File.read(File.join(File.dirname(__FILE__), "iban_rules.yml")))
65
+ YAML.safe_load(File.read(File.join(File.dirname(__FILE__), "iban_rules.yml")))
66
66
  .transform_values { |h| h.merge("bban_pattern" => /\A#{h.fetch("bban_pattern")}\z/) }
67
67
  end
68
68
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module BankTools
4
4
  module Global
5
- VERSION = "1.0.1"
5
+ VERSION = "1.0.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banktools-global
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-19 00:00:00.000000000 Z
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email:
15
15
  - henrik@nyh.se
16
16
  executables: []
@@ -20,6 +20,7 @@ files:
20
20
  - ".github/workflows/main.yml"
21
21
  - ".gitignore"
22
22
  - ".rspec"
23
+ - ".rubocop.yml"
23
24
  - CHANGELOG.md
24
25
  - Gemfile
25
26
  - Gemfile.lock
@@ -39,10 +40,11 @@ homepage: https://github.com/barsoom/banktools-global
39
40
  licenses:
40
41
  - MIT
41
42
  metadata:
43
+ rubygems_mfa_required: 'true'
42
44
  homepage_uri: https://github.com/barsoom/banktools-global
43
45
  source_code_uri: https://github.com/barsoom/banktools-global
44
- changelog_uri: https://github.com/barsoom/banktools-global/blob/master/README.md
45
- post_install_message:
46
+ changelog_uri: https://github.com/barsoom/banktools-global/blob/main/README.md
47
+ post_install_message:
46
48
  rdoc_options: []
47
49
  require_paths:
48
50
  - lib
@@ -57,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
59
  - !ruby/object:Gem::Version
58
60
  version: '0'
59
61
  requirements: []
60
- rubygems_version: 3.1.4
61
- signing_key:
62
+ rubygems_version: 3.2.28
63
+ signing_key:
62
64
  specification_version: 4
63
65
  summary: Validate and normalize international bank account numbers like IBAN/BIC.
64
66
  Based on iban-tools.