base64 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 5a5ed97490e357afc22d3a6abd81a414b83f0ba0518ae6d70ce96e1fc27ceacc
4
- data.tar.gz: 6f5e2d2f066a6ef3fd672023ad169676bb91462edc19a4091bdb04f33bc4e2de
3
+ metadata.gz: 9cdb7f1229721d778c55acf3ba0d52d0cfd01af75b642879cad18c897324f2d3
4
+ data.tar.gz: f14d863cab6d699c6ed29f7c463da7b6fe0566410dbc21bdfc5c6880b0cd5056
5
5
  SHA512:
6
- metadata.gz: 472ef81375e3cfae4baf72a77f6253f219d044726ba2f108f93ad334a435912465dc231022760b7b05fdf76ef6da0dc8bdcd189f5d0c20c3f3386ad2b547a90a
7
- data.tar.gz: 13b206da0ad209a9ba9aee927b7f3512551b1649c15e10562a51e17845cc1b8d924eb0e36b481e0f31e4f2c8a90956d7cffeb61c771484073f812285329c5a60
6
+ metadata.gz: 2b38e41b62859eeb7d5ec7a2111c323e5dca272889f3a8d611fec3c8cc9cc2bfc932f243544d1f3edd745930cac9a340de0d7deb03c2e6f85b12b9a5be77f2f7
7
+ data.tar.gz: 7ebc528a0e7256f18f5efb8d5e69cc1599c640d1393124d08c33ad643ba45764f003830c9820282b2487f162f2db9681f811142e45bd3f9537e437f3becb9ef1
data/lib/base64.rb CHANGED
@@ -82,8 +82,8 @@ module Base64
82
82
  # You can remove the padding by setting +padding+ as false.
83
83
  def urlsafe_encode64(bin, padding: true)
84
84
  str = strict_encode64(bin)
85
+ str.chomp!("==") or str.chomp!("=") unless padding
85
86
  str.tr!("+/", "-_")
86
- str.delete!("=") unless padding
87
87
  str
88
88
  end
89
89
 
@@ -99,9 +99,11 @@ module Base64
99
99
  # NOTE: RFC 4648 does say nothing about unpadded input, but says that
100
100
  # "the excess pad characters MAY also be ignored", so it is inferred that
101
101
  # unpadded input is also acceptable.
102
- str = str.tr("-_", "+/")
103
102
  if !str.end_with?("=") && str.length % 4 != 0
104
103
  str = str.ljust((str.length + 3) & ~3, "=")
104
+ str.tr!("-_", "+/")
105
+ else
106
+ str = str.tr("-_", "+/")
105
107
  end
106
108
  strict_decode64(str)
107
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: base64
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Endoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-18 00:00:00.000000000 Z
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Support for encoding and decoding binary data using a Base64 representation.
14
14
  email:
@@ -17,15 +17,8 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - ".github/workflows/test.yml"
21
- - ".gitignore"
22
- - Gemfile
23
20
  - LICENSE.txt
24
21
  - README.md
25
- - Rakefile
26
- - base64.gemspec
27
- - bin/console
28
- - bin/setup
29
22
  - lib/base64.rb
30
23
  homepage: https://github.com/ruby/base64
31
24
  licenses:
@@ -49,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
42
  - !ruby/object:Gem::Version
50
43
  version: '0'
51
44
  requirements: []
52
- rubygems_version: 3.2.0.rc.1
45
+ rubygems_version: 3.2.22
53
46
  signing_key:
54
47
  specification_version: 4
55
48
  summary: Support for encoding and decoding binary data using a Base64 representation.
@@ -1,24 +0,0 @@
1
- name: test
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
- strategy:
9
- matrix:
10
- ruby: [ 2.7, 2.6, 2.5, head ]
11
- os: [ ubuntu-latest, macos-latest ]
12
- runs-on: ${{ matrix.os }}
13
- steps:
14
- - uses: actions/checkout@master
15
- - name: Set up Ruby
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: ${{ matrix.ruby }}
19
- - name: Install dependencies
20
- run: |
21
- gem install bundler --no-document
22
- bundle install
23
- - name: Run test
24
- run: rake test
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "rake"
4
- gem "minitest"
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/test_*.rb"]
8
- end
9
-
10
- task :default => :test
data/base64.gemspec DELETED
@@ -1,22 +0,0 @@
1
- Gem::Specification.new do |spec|
2
- spec.name = "base64"
3
- spec.version = "0.1.0"
4
- spec.authors = ["Yusuke Endoh"]
5
- spec.email = ["mame@ruby-lang.org"]
6
-
7
- spec.summary = %q{Support for encoding and decoding binary data using a Base64 representation.}
8
- spec.description = %q{Support for encoding and decoding binary data using a Base64 representation.}
9
- spec.homepage = "https://github.com/ruby/base64"
10
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
11
- spec.licenses = ["Ruby", "BSD-2-Clause"]
12
-
13
- spec.metadata["homepage_uri"] = spec.homepage
14
- spec.metadata["source_code_uri"] = spec.homepage
15
-
16
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ["lib"]
22
- end
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "base64"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here