The inbuilt Base64 library in Ruby is adding some \'\\n\'s. I\'m unable to find out the reason. For this special example:
irb(main):001:0> require \'rubyg
The \n added when using Base64#encode64 is correct, check this post out: https://glaucocustodio.github.io/2014/09/27/a-reminder-about-base64encode64-in-ruby/
\n
Base64#encode64