diff options
author | Joao Fernandes <[email protected]> | 2021-09-02 16:57:26 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2021-09-27 15:23:12 +0900 |
commit | 1b004ba0db2b8e4e0a6b3362dd7681e0c642cab0 (patch) | |
tree | b98f065dc574f8d0766965589f315652166e3db0 /lib/base64.rb | |
parent | 05a28ce5b11d0e0ca48bae799ef65e9657dc4f6a (diff) |
[ruby/base64] Simplify
Thanks @nobu!
https://github.com/ruby/base64/commit/39e22efa2b
Diffstat (limited to 'lib/base64.rb')
-rw-r--r-- | lib/base64.rb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/base64.rb b/lib/base64.rb index 6b049982cf..de1e8c0e55 100644 --- a/lib/base64.rb +++ b/lib/base64.rb @@ -82,13 +82,7 @@ module Base64 # You can remove the padding by setting +padding+ as false. def urlsafe_encode64(bin, padding: true) str = strict_encode64(bin) - unless padding - if str.end_with?("==") - str.delete_suffix!("==") - elsif str.end_with?("=") - str.chop! - end - end + str.chomp!("==") or str.chomp!("=") unless padding str.tr!("+/", "-_") str end |