Class: RandomGenerators::RandomGenerator

Inherits:
Object
  • Object
show all
Includes:
Abstract
Defined in:
lib/random_generators/random_generator.rb

Direct Known Subclasses

Ruby

Instance Method Summary collapse

Methods included from Abstract

included

Instance Method Details

#check_choose_float(f) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/random_generators/random_generator.rb', line 20

def check_choose_float ( f )
  unless f.is_a? Float
    raise ArgumentError, "Need a float (not #{f})"
  end
  if f <= 0
    raise ArgumentError, "Need an positive value (not #{f})"
  end
end

#check_choose_integer(n) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/random_generators/random_generator.rb', line 11

def check_choose_integer ( n )
  unless n.is_a? Integer
    raise ArgumentError, "Need an integer (not #{n})"
  end
  if n <= 0
    raise ArgumentError, "Need an positive value (not #{n})"
  end
end