Skip to content

Commit

Permalink
Use unpack1 instead of unpack and first
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
znz committed Feb 10, 2017
1 parent 07b88b2 commit 9779584
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/base64.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def encode64(bin)
# This is line three
# And so on...
def decode64(str)
str.unpack("m").first
str.unpack1("m")
end

# Returns the Base64-encoded version of +bin+.
Expand All @@ -71,7 +71,7 @@ def strict_encode64(bin)
# ArgumentError is raised if +str+ is incorrectly padded or contains
# non-alphabet characters. Note that CR or LF are also rejected.
def strict_decode64(str)
str.unpack("m0").first
str.unpack1("m0")
end

# Returns the Base64-encoded version of +bin+.
Expand Down

0 comments on commit 9779584

Please sign in to comment.