Ruby 2.4.0 リファレンスマニュアル > ライブラリ一覧 > base64ライブラリ > Base64モジュール > decode64

module function Base64.#decode64

decode64(str) -> String[permalink][rdoc]

与えられた文字列を Base64 デコードしたデータを返します。

このメソッドは [RFC2045] に対応しています。

[PARAM] str:
Base64 デコードする文字列を指定します。
require 'base64'
str = 'VGhpcyBpcyBsaW5lIG9uZQpUaGlzIG' +
      'lzIGxpbmUgdHdvClRoaXMgaXMgbGlu' +
      'ZSB0aHJlZQpBbmQgc28gb24uLi4K'
puts Base64.decode64(str)

# This is line one
# This is line two
# This is line three
# And so on...