free_mutant/lib/mutant/delegator.rb
Markus Schirp 41d9700473 Refactor runer infrastructure
* Nuke around 800 lock
* Honor LSP with not anymore squeezing something non LSP compatible in
  the same inheritance tree.
* Separate running from result tree.
* Clean up kill logic and early exits on already dead mutations.
* Fix #runnin? smell for reporters.
* Decouple config object from VM state. Makes it serializable to enable
  config loading.
* Fix sequence of global VM events to match PRIOR rspec infects VM with
  gazillions of classes / modules. Thix fixes a startup speed
  degeneration.
* Various fixes to enhance determinism.
* Replace some unneded manual double dispatch with single manual dispatch for
  reporter / runners.
2014-07-05 23:04:38 +00:00

52 lines
944 B
Ruby

module Mutant
# A simple delegator with opinions
module Delegator
# Class level mixins
module ClassMethods
private
# Create delegators to object
#
# @return [undefined]
#
# @api private
#
def delegate(*names)
names.each(&method(:define_delegator))
end
# Create delegator to object
#
# @param [Symbol] name
#
# @return [undefined]
#
# @api private
#
def define_delegator(name)
fail if instance_methods.include?(name)
define_method(name) do
object.public_send(name)
end
private name
end
end # ClassMethods
# Hook called when module is included
#
# @param [Class,Module] host
#
# @return [undefined]
#
# @api private
#
def self.included(host)
super
host.extend(ClassMethods)
end
end # Delegator
end # Mutant