class method
self.base64
Ruby on Rails 3.0.20
Since v2.2.3 Last seen in v3.0.20Signature
self.base64(n=nil)
SecureRandom.base64 generates a random base64 string.
The argument n specifies the length of the random length. The length of the result string is about 4/3 of n.
If n is not specified, 16 is assumed. It may be larger in future.
If secure random number generator is not available, NotImplementedError is raised.
Parameters
-
nopt = nil
Source
# File activesupport/lib/active_support/secure_random.rb, line 151
def self.base64(n=nil)
[random_bytes(n)].pack("m*").delete("\n")
end
Defined in activesupport/lib/active_support/secure_random.rb line 151
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::SecureRandom