Module: JekyllMiscellaneous::Filters::Base64

Defined in:
lib/jekyll_miscellaneous/filters/base64.rb

Instance Method Summary collapse

Instance Method Details

#base64_decode(input) ⇒ Object

Decodes a Base64 string, and returns the result.

Parameters:

input

The Base64 string to decode.

Returns:

The decoded string.

Example:

base64_decode('SGVsbG8sIFdvcmxkIQ==')
# => "Hello, World!"


35
36
37
# File 'lib/jekyll_miscellaneous/filters/base64.rb', line 35

def base64_decode(input)
  ::Base64.decode64(input)
end

#base64_encode(input) ⇒ Object

Encodes a string to Base64, and returns the result.

Parameters:

input

The string to encode.

Returns:

The Base64 encoded string.

Example:

base64_encode('Hello, World!')
# => "SGVsbG8sIFdvcmxkIQ=="


19
20
21
# File 'lib/jekyll_miscellaneous/filters/base64.rb', line 19

def base64_encode(input)
  ::Base64.encode64(input)
end