[英]Undefined method `b64encode' for Base64:Module - Ruby
[![enter image description here][1]][1] [![在此处输入图片描述] [1]] [1]
Hi, I want to encode a string whose length is more than default 60. Therefore, I can't use the Base64.encode64 method. 嗨,我想对长度大于默认值60的字符串进行编码。因此,我不能使用Base64.encode64方法。
From the following link - http://ruby-doc.org/stdlib-1.8.7/libdoc/base64/rdoc/Base64.html 从以下链接-http://ruby-doc.org/stdlib-1.8.7/libdoc/base64/rdoc/Base64.html
I got to know about b64encode(bin, len = 60) method. 我了解b64encode(bin,len = 60)方法。 But on using, it shows the error -
但是在使用时,它显示错误-
in `<top (required)>': undefined method `b64encode' for Base64:Module (NoMethodError)
Where am I making the mistake. 我在哪里犯错。
PS - The version of Ruby for me is ruby 2.3.0p0
PS-对我来说Ruby的版本是
ruby 2.3.0p0
Base64
has no method b64encode
. Base64
没有方法b64encode
。 You are reading the documentation for Ruby 1.8.7, which was released in 2008 and retired in 2013 . 您正在阅读Ruby 1.8.7的文档,该文档于2008年发布, 于2013年停用 。
The available method for encoding is Base64.encode64
. 可用的编码方法是
Base64.encode64
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.