class Mocker
Attributes
max_float[RW]
max_int[RW]
min_float[RW]
min_int[RW]
number_of_words[RW]
words[RW]
Public Class Methods
new(min_int = 0, max_int = 100, min_float = 0.0, max_float = 100.0, words = 'lorem ipsum dolor sit amet consectetur adipiscing elit'.split(), number_of_words = 1)
click to toggle source
# File lib/hold_the_fort/mocker.rb, line 9 def initialize(min_int = 0, max_int = 100, min_float = 0.0, max_float = 100.0, words = 'lorem ipsum dolor sit amet consectetur adipiscing elit'.split(), number_of_words = 1) @min_int = min_int @max_int = max_int @min_float = min_float @max_float = max_float @words = words @number_of_words = number_of_words end
Public Instance Methods
float()
click to toggle source
# File lib/hold_the_fort/mocker.rb, line 27 def float @float ||= Random.new.rand(min_float..max_float) end
int()
click to toggle source
# File lib/hold_the_fort/mocker.rb, line 23 def int @int ||= Random.new.rand(min_int..max_int) end
string()
click to toggle source
# File lib/hold_the_fort/mocker.rb, line 31 def string @string ||= words.sample(number_of_words) end