summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-05 03:12:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-05 03:12:20 +0000
commitd32763eca0817c92ee0451ee6e08576879317e22 (patch)
tree9c1609d1a6da445ed8bf1c22cf5d7f5d708e4836
parenta99d017db7c3019827b843d1ae87830bd64ad193 (diff)
securerandom.rb: [DOC] require in examples
* lib/securerandom.rb: added `require 'securerandom'` to each example, to state these methods are defined in this library and require it explicitly. [ruby-core:85933] [Bug #14576] [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/securerandom.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index 6d5520f605..598e827fd1 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -119,6 +119,8 @@ module Random::Formatter
#
# The result may contain any byte: "\x00" - "\xff".
#
+ # require 'securerandom'
+ #
# p SecureRandom.random_bytes #=> "\xD8\\\xE0\xF4\r\xB2\xFC*WM\xFF\x83\x18\xF45\xB6"
# p SecureRandom.random_bytes #=> "m\xDC\xFC/\a\x00Uf\xB2\xB2P\xBD\xFF6S\x97"
#
@@ -139,6 +141,8 @@ module Random::Formatter
#
# The result may contain 0-9 and a-f.
#
+ # require 'securerandom'
+ #
# p SecureRandom.hex #=> "eb693ec8252cd630102fd0d0fb7c3485"
# p SecureRandom.hex #=> "91dc3bfb4de5b11d029d376634589b61"
#
@@ -158,6 +162,8 @@ module Random::Formatter
#
# The result may contain A-Z, a-z, 0-9, "+", "/" and "=".
#
+ # require 'securerandom'
+ #
# p SecureRandom.base64 #=> "/2BuBuLf3+WfSKyQbRcc/A=="
# p SecureRandom.base64 #=> "6BbW0pxO0YENxn38HMUbcQ=="
#
@@ -185,6 +191,8 @@ module Random::Formatter
# The result may contain A-Z, a-z, 0-9, "-" and "_".
# "=" is also used if _padding_ is true.
#
+ # require 'securerandom'
+ #
# p SecureRandom.urlsafe_base64 #=> "b4GOKm4pOYU_-BOXcrUGDg"
# p SecureRandom.urlsafe_base64 #=> "UZLdOkzop70Ddx-IJR0ABg"
#
@@ -204,6 +212,8 @@ module Random::Formatter
# SecureRandom.uuid generates a random v4 UUID (Universally Unique IDentifier).
#
+ # require 'securerandom'
+ #
# p SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
# p SecureRandom.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
# p SecureRandom.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
@@ -236,6 +246,8 @@ module Random::Formatter
#
# The result may contain whatever characters are in the source array.
#
+ # require 'securerandom'
+ #
# p SecureRandom.choose([*'l'..'r'], 16) #=> "lmrqpoonmmlqlron"
# p SecureRandom.choose([*'0'..'9'], 5) #=> "27309"
#
@@ -281,6 +293,8 @@ module Random::Formatter
#
# The result may contain A-Z, a-z and 0-9.
#
+ # require 'securerandom'
+ #
# p SecureRandom.alphanumeric #=> "2BuBuLf3WfSKyQbR"
# p SecureRandom.alphanumeric(10) #=> "i6K93NdqiH"
#