D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Random
/
Formatter
/
Filename :
urlsafe_base64-i.ri
back
Copy
U:RDoc::AnyMethod[iI"urlsafe_base64:ETI"%Random::Formatter#urlsafe_base64;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I".Generate a random URL-safe base64 string.;To:RDoc::Markup::BlankLine o; ; [I"KThe argument _n_ specifies the length, in bytes, of the random number ;TI"Jto be generated. The length of the result string is about 4/3 of _n_.;T@o; ; [I"7If _n_ is not specified or is nil, 16 is assumed. ;TI"$It may be larger in the future.;T@o; ; [ I";The boolean argument _padding_ specifies the padding. ;TI"6If it is false or nil, padding is not generated. ;TI"%Otherwise padding is generated. ;TI"UBy default, padding is not generated because "=" may be used as a URL delimiter.;T@o; ; [I"8The result may contain A-Z, a-z, 0-9, "-" and "_". ;TI"+"=" is also used if _padding_ is true.;T@o:RDoc::Markup::Verbatim; [I" require 'random/formatter' ;TI" ;TI"8Random.urlsafe_base64 #=> "b4GOKm4pOYU_-BOXcrUGDg" ;TI" # or ;TI"prng = Random.new ;TI"6prng.urlsafe_base64 #=> "UZLdOkzop70Ddx-IJR0ABg" ;TI" ;TI"Cprng.urlsafe_base64(nil, true) #=> "i0XQ-7gglIsHGV2_BNPrdQ==" ;TI"Cprng.urlsafe_base64(nil, true) #=> "-M8rLhr7JEpJlqFGUMmOxg==" ;T:@format0o; ; [I"8See RFC 3548 for the definition of URL-safe base64.;T: @fileI"lib/random/formatter.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(n=nil, padding=false);T@/FI"Formatter;TcRDoc::NormalModule00