Class: AnswerFactory::Machines::RemoveAnyOne

Inherits:
Machine
  • Object
show all
Defined in:
lib/machines/any_one.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

#screen(batch) ⇒ Object Also known as: generate

Raises:

  • (ArgumentError)


24
25
26
27
28
29
30
31
# File 'lib/machines/any_one.rb', line 24

def screen(batch)
  raise ArgumentError, "RemoveAnyOne#screen: argument is not a Batch" unless
    batch.kind_of?(Batch)
  working_copy = batch.dup
  where = rand(working_copy.length)
  working_copy.delete_at(where)
  return working_copy
end