class RandomlyGenerated::Integer
Attributes
maximum[R]
minimum[R]
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
RandomlyGenerated::Object::new
# File lib/randomly_generated/integer.rb, line 14 def initialize(options={}) super options[:range] ||= Integer::MIN..Integer::MAX @minimum = options.fetch(:minimum) { options.fetch(:range).first } @maximum = options.fetch(:maximum) { options.fetch(:range).last } end
Public Instance Methods
call()
click to toggle source
# File lib/randomly_generated/integer.rb, line 21 def call # TODO: We should weight this to make more "special edge-case" results show up -- like 0, 1, Integer::MAX, etc. @value ||= rand.rand(minimum..maximum) end