Class: AnswerFactory::Machines::BuildRandom

Inherits:
Machine
  • Object
show all
Defined in:
lib/machines/build_random.rb

Instance Attribute Summary

Attributes inherited from Machine

#options

Instance Method Summary collapse

Methods inherited from Machine

#initialize

Constructor Details

This class inherits a constructor from AnswerFactory::Machines::Machine

Instance Method Details

#build(batch = nil, overridden_options = {}) ⇒ Object Also known as: generate



10
11
12
13
14
15
16
# File 'lib/machines/build_random.rb', line 10

def build(batch = nil, overridden_options = {})
  all_options = @options.merge(overridden_options)
  how_many = all_options[:how_many] || 1
  result = Batch.new
  how_many.times {result << Answer.new(NudgeProgram.random(all_options))}
  return result
end