Module: Mutant

Defined in:
lib/mutant.rb,
lib/mutant/cli.rb,
lib/mutant/color.rb,
lib/mutant/differ.rb,
lib/mutant/helper.rb,
lib/mutant/killer.rb,
lib/mutant/loader.rb,
lib/mutant/random.rb,
lib/mutant/runner.rb,
lib/mutant/context.rb,
lib/mutant/matcher.rb,
lib/mutant/mutator.rb,
lib/mutant/subject.rb,
lib/mutant/mutation.rb,
lib/mutant/reporter.rb,
lib/mutant/strategy.rb,
lib/mutant/killer/rspec.rb,
lib/mutant/mutator/node.rb,
lib/mutant/mutator/util.rb,
lib/mutant/reporter/cli.rb,
lib/mutant/context/scope.rb,
lib/mutant/killer/static.rb,
lib/mutant/matcher/chain.rb,
lib/mutant/reporter/null.rb,
lib/mutant/killer/forking.rb,
lib/mutant/matcher/method.rb,
lib/mutant/reporter/stats.rb,
lib/mutant/strategy/rspec.rb,
lib/mutant/mutation/filter.rb,
lib/mutant/mutator/registry.rb,
lib/mutant/mutator/node/noop.rb,
lib/mutant/mutator/node/send.rb,
lib/mutant/mutator/node/block.rb,
lib/mutant/mutator/node/define.rb,
lib/mutant/mutator/node/return.rb,
lib/mutant/matcher/object_space.rb,
lib/mutant/mutation/filter/code.rb,
lib/mutant/mutator/node/literal.rb,
lib/mutant/matcher/scope_methods.rb,
lib/mutant/support/method_object.rb,
lib/mutant/mutation/filter/regexp.rb,
lib/mutant/mutator/node/arguments.rb,
lib/mutant/matcher/method/instance.rb,
lib/mutant/matcher/method/singleton.rb,
lib/mutant/mutator/node/literal/nil.rb,
lib/mutant/matcher/method/classifier.rb,
lib/mutant/mutation/filter/whitelist.rb,
lib/mutant/mutator/node/if_statement.rb,
lib/mutant/mutator/node/literal/hash.rb,
lib/mutant/mutator/node/literal/array.rb,
lib/mutant/mutator/node/literal/float.rb,
lib/mutant/mutator/node/literal/range.rb,
lib/mutant/mutator/node/literal/regex.rb,
lib/mutant/mutator/node/receiver_case.rb,
lib/mutant/mutator/node/literal/fixnum.rb,
lib/mutant/mutator/node/literal/string.rb,
lib/mutant/mutator/node/literal/symbol.rb,
lib/mutant/mutator/node/literal/boolean.rb,
lib/mutant/mutator/node/literal/dynamic.rb,
lib/mutant/strategy/rspec/example_lookup.rb,
lib/mutant/mutator/node/literal/empty_array.rb

Overview

Library namespace

Defined Under Namespace

Modules: Helper, MethodObject, Random Classes: CLI, Color, Context, Differ, Killer, Loader, Matcher, Mutation, Mutator, Reporter, Runner, Strategy, Subject

Constant Summary collapse

PID =
Process.pid

Class Method Summary collapse

Class Method Details

.define_singleton_subclass(name, superclass, &block) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Define instance of subclassed superclass as constant

Parameters:

  • superclass (Class)
  • name (Symbol)

Returns:

  • (self)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/mutant.rb', line 29

def self.define_singleton_subclass(name, superclass, &block)
  klass = Class.new(superclass) do

    def inspect; self.class.name; end

    define_singleton_method(:name) do
      "#{superclass.name}::#{name}".freeze
    end

  end
  klass.class_eval(&block)
  superclass.const_set(name, klass.new)
  self
end