i may recieve these two strings:
base = Base64.encode64(File.open(\"/home/usr/Desktop/test\", \"rb\").read) => \"YQo=\\n\" string = File.open
You can use something like this, not very performant but you are guaranteed not to get false positives:
require 'base64' def base64?(value) value.is_a?(String) && Base64.encode64(Base64.decode64(value)) == value end