lib/ctf_party/base64.rb in ctf-party-1.5.0 vs lib/ctf_party/base64.rb in ctf-party-2.0.0
- old
+ new
@@ -4,12 +4,12 @@
require 'base64'
class String
# Encode the string into base64
# @param opts [Hash] optional parameters
- # @option opts [Symbol] :mode Default value: +:strict+.
- # Other values are +:strict+ (+:rfc4648+) or +:urlsafe+.
+ # @option opts [Symbol] :mode Default value: `:strict`.
+ # Other values are `:strict` (`:rfc4648`) or `:urlsafe`.
# @see https://ruby-doc.org/stdlib-2.6.5/libdoc/base64/rdoc/Base64.html
# @return [String] the Base64 encoded string
# @example
# 'Super lib!'.to_b64 # => "U3VwZXIgbGliIQ=="
def to_b64(opts = {})
@@ -30,12 +30,12 @@
replace(to_b64(opts))
end
# Decode the string from base64
# @param opts [Hash] optional parameters
- # @option opts [Symbol] :mode Default value: +:strict+.
- # Other values are +:strict+ (+:rfc4648+) or +:urlsafe+.
+ # @option opts [Symbol] :mode Default value: `:strict`.
+ # Other values are `:strict` (`:rfc4648`) or `:urlsafe`.
# @see https://ruby-doc.org/stdlib-2.6.5/libdoc/base64/rdoc/Base64.html
# @return [String] the Base64 decoded string
# @example
# 'UnVieQ=='.from_b64 # => "Ruby"
def from_b64(opts = {})
@@ -56,13 +56,13 @@
replace(from_b64(opts))
end
# Is the string encoded in base64?
# @param opts [Hash] optional parameters
- # @option opts [Symbol] :mode Default value: +:strict+.
- # Other values are +:strict+ (+:rfc4648+) or +:urlsafe+.
+ # @option opts [Symbol] :mode Default value: `:strict`.
+ # Other values are `:strict` (`:rfc4648`) or `:urlsafe`.
# @see https://ruby-doc.org/stdlib-2.6.5/libdoc/base64/rdoc/Base64.html
- # @return [Boolean] +true+ if the string is a valid base64 string, +false+
+ # @return [Boolean] `true` if the string is a valid base64 string, `false`
# else.
# @example
# 'SGVsbG8gd29ybGQh'.b64? # => true
# 'SGVsbG8g@@d29ybGQh'.b64? # => false
def b64?(opts = {})