class RandTest::AsciiGenerator
Constants
- CHARS
Public Class Methods
random_ascii_between(min, max, options={})
click to toggle source
# File lib/rand-rspec/strings/ascii_generator.rb, line 13 def random_ascii_between(min, max, options={}) size = random_number_between(min, max) spaces = options[:spaces] || false (min...(min+size)).inject("") do |acc, obj| if (spaces && (rand(2) > 0)) acc << " " else acc << CHARS[rand(CHARS.size)].chr end end end