[前][次][番号順一覧][スレッド一覧]

ruby-changes:51134

From: nobu <ko1@a...>
Date: Sat, 5 May 2018 12:12:25 +0900 (JST)
Subject: [ruby-changes:51134] nobu:r63341 (trunk): securerandom.rb: [DOC] require in examples

nobu	2018-05-05 12:12:20 +0900 (Sat, 05 May 2018)

  New Revision: 63341

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63341

  Log:
    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]

  Modified files:
    trunk/lib/securerandom.rb
Index: lib/securerandom.rb
===================================================================
--- lib/securerandom.rb	(revision 63340)
+++ lib/securerandom.rb	(revision 63341)
@@ -119,6 +119,8 @@ module Random::Formatter https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L119
   #
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L141
   #
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L162
   #
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L191
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L212
 
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L246
   #
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L293
   #
   # The result may contain A-Z, a-z and 0-9.
   #
+  #   require 'securerandom'
+  #
   #   p SecureRandom.alphanumeric #=> "2BuBuLf3WfSKyQbR"
   #   p SecureRandom.alphanumeric(10) #=> "i6K93NdqiH"
   #

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]