class RandomlyGenerated::String
Attributes
length[R]
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
RandomlyGenerated::Object::new
# File lib/randomly_generated/string.rb, line 4 def initialize(options={}) super @length = options.fetch(:length) { (1..5000) } @length = rand.rand(@length) if @length.is_a?(Range) end
Public Instance Methods
call()
click to toggle source
# File lib/randomly_generated/string.rb, line 10 def call @value ||= rand.bytes(length) # TODO: This doesn't handle Unicode characters, only code points 0-255. end