2013-07-28 16:03:06 -07:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2012-11-22 00:10:50 +01:00
|
|
|
module Mutant
|
2013-01-04 22:16:03 +01:00
|
|
|
|
|
|
|
# Abstract base class for killing strategies
|
2013-04-17 20:31:21 -07:00
|
|
|
class Strategy
|
2013-06-15 16:32:40 +02:00
|
|
|
include AbstractType, Adamantium::Flat
|
2012-12-11 00:17:19 +01:00
|
|
|
|
2013-07-17 19:59:44 +02:00
|
|
|
# Perform strategy setup
|
2012-12-11 00:17:19 +01:00
|
|
|
#
|
2013-01-15 23:46:05 +01:00
|
|
|
# @return [self]
|
2012-12-11 00:17:19 +01:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-07-17 19:59:44 +02:00
|
|
|
def setup
|
2013-09-02 22:02:51 +02:00
|
|
|
self
|
2012-12-11 00:17:19 +01:00
|
|
|
end
|
|
|
|
|
2013-07-17 19:59:44 +02:00
|
|
|
# Perform strategy teardown
|
2012-12-11 00:17:19 +01:00
|
|
|
#
|
2013-01-15 23:46:05 +01:00
|
|
|
# @return [self]
|
2012-12-11 00:17:19 +01:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-07-17 19:59:44 +02:00
|
|
|
def teardown
|
2013-09-02 22:02:51 +02:00
|
|
|
self
|
2012-12-11 00:17:19 +01:00
|
|
|
end
|
2012-11-22 00:10:50 +01:00
|
|
|
|
|
|
|
# Kill mutation
|
|
|
|
#
|
2012-12-12 22:31:14 +01:00
|
|
|
# @param [Mutation] mutation
|
2012-11-22 00:10:50 +01:00
|
|
|
#
|
|
|
|
# @return [Killer]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-07-17 19:59:44 +02:00
|
|
|
def kill(mutation)
|
2012-11-22 00:10:50 +01:00
|
|
|
killer.new(self, mutation)
|
|
|
|
end
|
|
|
|
|
2013-07-17 19:59:44 +02:00
|
|
|
private
|
|
|
|
|
2012-12-07 16:55:53 +01:00
|
|
|
# Return killer
|
|
|
|
#
|
|
|
|
# @return [Class:Killer]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-07-17 19:59:44 +02:00
|
|
|
def killer
|
|
|
|
self.class::KILLER
|
2012-11-22 00:10:50 +01:00
|
|
|
end
|
2013-06-14 20:54:02 +02:00
|
|
|
|
|
|
|
end # Strategy
|
|
|
|
end # Mutant
|