class method self.base64

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v3.0.20

Available in: v2.2.3 v2.3.18 v3.0.20

Signature

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

n opt = nil
Source
# File activesupport/lib/active_support/secure_random.rb, line 149
      def self.base64(n=nil)
        [random_bytes(n)].pack("m*").delete("\n")
      end

Defined in activesupport/lib/active_support/secure_random.rb line 149 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::SecureRandom

Type at least 2 characters to search.

↑↓ navigate · open · esc close