Class: MimiCheck::Generator::Array

Inherits:
Object
  • Object
show all
Includes:
MimiCheck::Generator
Defined in:
lib/mimicheck/generator/array.rb

Instance Method Summary collapse

Methods included from MimiCheck::Generator

#call, #to_proc

Constructor Details

#initialize(generator = default_gen, size_range = 0..20) ⇒ Array

Returns a new instance of Array.



6
7
8
9
# File 'lib/mimicheck/generator/array.rb', line 6

def initialize(generator = default_gen, size_range = 0..20)
  @generator = generator
  @size_range = size_range
end

Instance Method Details

#generateObject



13
14
15
16
# File 'lib/mimicheck/generator/array.rb', line 13

def generate
  size = Int.new(size_range).generate
  (1..size).map { generator.call }
end