Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions sig/base64.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError
#
# Method Base64.urlsafe_decode64 allows padding in `str`, which if present, must
# be correct: see [Padding](Base64.html#module-Base64-label-Padding), above:
# Method Base64.urlsafe_decode64 allows padding in the encoded string, which if
# present, must be correct: see
# [Padding](Base64.html#module-Base64-label-Padding), above:
#
# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567"
# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567"
Expand Down Expand Up @@ -182,21 +183,21 @@
module Base64
# <!--
# rdoc-file=lib/base64.rb
# - decode64(str)
# - Base64.decode(encoded_string) -> decoded_string
# -->
# Returns a string containing the decoding of an RFC-2045-compliant
# Base64-encoded string `str`:
# Base64-encoded string `encoded_string`:
#
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n"
# Base64.decode64(s) # => "This is line 1\nThis is line 2\n"
#
# Non-Base64 characters in `str` are ignored; see [Encoding Character
# Non-Base64 characters in `encoded_string` are ignored; see [Encoding Character
# Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: these
# include newline characters and characters `-` and `/`:
#
# Base64.decode64("\x00\n-_") # => ""
#
# Padding in `str` (even if incorrect) is ignored:
# Padding in `encoded_string` (even if incorrect) is ignored:
#
# Base64.decode64("MDEyMzQ1Njc") # => "01234567"
# Base64.decode64("MDEyMzQ1Njc=") # => "01234567"
Expand All @@ -206,9 +207,10 @@ module Base64

# <!--
# rdoc-file=lib/base64.rb
# - encode64(bin)
# - Base64.encode64(string) -> encoded_string
# -->
# Returns a string containing the RFC-2045-compliant Base64-encoding of `bin`.
# Returns a string containing the RFC-2045-compliant Base64-encoding of
# `string`.
#
# Per RFC 2045, the returned string may contain the URL-unsafe characters `+` or
# `/`; see [Encoding Character
Expand Down Expand Up @@ -241,23 +243,23 @@ module Base64

# <!--
# rdoc-file=lib/base64.rb
# - strict_decode64(str)
# - Base64.strict_decode64(encoded_string) -> decoded_string
# -->
# Returns a string containing the decoding of an RFC-2045-compliant
# Base64-encoded string `str`:
# Base64-encoded string `encoded_string`:
#
# s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
# Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n"
#
# Non-Base64 characters in `str` not allowed; see [Encoding Character
# Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: these
# include newline characters and characters `-` and `/`:
# Non-Base64 characters in `encoded_string` are not allowed; see [Encoding
# Character Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above:
# these include newline characters and characters `-` and `/`:
#
# Base64.strict_decode64("\n") # Raises ArgumentError
# Base64.strict_decode64('-') # Raises ArgumentError
# Base64.strict_decode64('_') # Raises ArgumentError
#
# Padding in `str`, if present, must be correct:
# Padding in `encoded_string`, if present, must be correct:
#
# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError
# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567"
Expand All @@ -267,9 +269,10 @@ module Base64

# <!--
# rdoc-file=lib/base64.rb
# - strict_encode64(bin)
# - Base64.strict_encode64(string) -> encoded_string
# -->
# Returns a string containing the RFC-2045-compliant Base64-encoding of `bin`.
# Returns a string containing the RFC-2045-compliant Base64-encoding of
# `string`.
#
# Per RFC 2045, the returned string may contain the URL-unsafe characters `+` or
# `/`; see [Encoding Character
Expand Down Expand Up @@ -301,18 +304,19 @@ module Base64

# <!--
# rdoc-file=lib/base64.rb
# - urlsafe_decode64(str)
# - Base64.urlsafe_decode64(encoded_string) -> decoded_string
# -->
# Returns the decoding of an RFC-4648-compliant Base64-encoded string `str`:
# Returns the decoding of an RFC-4648-compliant Base64-encoded string
# `encoded_string`:
#
# `str` may not contain non-Base64 characters; see [Encoding Character
# Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above:
# `encoded_string` may not contain non-Base64 characters; see [Encoding
# Character Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above:
#
# Base64.urlsafe_decode64('+') # Raises ArgumentError.
# Base64.urlsafe_decode64('/') # Raises ArgumentError.
# Base64.urlsafe_decode64("\n") # Raises ArgumentError.
#
# Padding in `str`, if present, must be correct: see
# Padding in `encoded_string`, if present, must be correct: see
# [Padding](Base64.html#module-Base64-label-Padding), above:
#
# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567"
Expand All @@ -323,9 +327,9 @@ module Base64

# <!--
# rdoc-file=lib/base64.rb
# - urlsafe_encode64(bin, padding: true)
# - Base64.urlsafe_encode64(string) -> encoded_string
# -->
# Returns the RFC-4648-compliant Base64-encoding of `bin`.
# Returns the RFC-4648-compliant Base64-encoding of `string`.
#
# Per RFC 4648, the returned string will not contain the URL-unsafe characters
# `+` or `/`, but instead may contain the URL-safe characters `-` and `_`; see
Expand Down