Module: Mutant

Defined in:
lib/mutant.rb,
lib/mutant.rb,
lib/mutant/ast.rb,
lib/mutant/env.rb,
lib/mutant/cli.rb,
lib/mutant/meta.rb,
lib/mutant/diff.rb,
lib/mutant/test.rb,
lib/mutant/color.rb,
lib/mutant/actor.rb,
lib/mutant/cache.rb,
lib/mutant/loader.rb,
lib/mutant/runner.rb,
lib/mutant/result.rb,
lib/mutant/config.rb,
lib/mutant/context.rb,
lib/mutant/subject.rb,
lib/mutant/version.rb,
lib/mutant/matcher.rb,
lib/mutant/mutator.rb,
lib/mutant/mutation.rb,
lib/mutant/reporter.rb,
lib/mutant/selector.rb,
lib/mutant/parallel.rb,
lib/mutant/ast/meta.rb,
lib/mutant/ast/sexp.rb,
lib/mutant/delegator.rb,
lib/mutant/ast/nodes.rb,
lib/mutant/isolation.rb,
lib/mutant/zombifier.rb,
lib/mutant/actor/env.rb,
lib/mutant/ast/types.rb,
lib/mutant/expression.rb,
lib/mutant/integration.rb,
lib/mutant/runner/sink.rb,
lib/mutant/actor/sender.rb,
lib/mutant/matcher/null.rb,
lib/mutant/reporter/cli.rb,
lib/mutant/mutator/util.rb,
lib/mutant/meta/example.rb,
lib/mutant/mutator/node.rb,
lib/mutant/actor/mailbox.rb,
lib/mutant/matcher/chain.rb,
lib/mutant/context/scope.rb,
lib/mutant/matcher/scope.rb,
lib/mutant/reporter/null.rb,
lib/mutant/env/bootstrap.rb,
lib/mutant/subject/method.rb,
lib/mutant/reporter/trace.rb,
lib/mutant/warning_filter.rb,
lib/mutant/matcher/filter.rb,
lib/mutant/matcher/method.rb,
lib/mutant/actor/receiver.rb,
lib/mutant/zombifier/file.rb,
lib/mutant/matcher/config.rb,
lib/mutant/parallel/source.rb,
lib/mutant/mutator/node/if.rb,
lib/mutant/matcher/methods.rb,
lib/mutant/parallel/worker.rb,
lib/mutant/parallel/master.rb,
lib/mutant/require_highjack.rb,
lib/mutant/meta/example/dsl.rb,
lib/mutant/matcher/compiler.rb,
lib/mutant/mutator/registry.rb,
lib/mutant/mutator/node/send.rb,
lib/mutant/matcher/namespace.rb,
lib/mutant/expression/method.rb,
lib/mutant/mutator/node/case.rb,
lib/mutant/integration/rspec.rb,
lib/mutant/reporter/cli/tput.rb,
lib/mutant/mutator/node/next.rb,
lib/mutant/mutator/node/dsym.rb,
lib/mutant/mutator/node/noop.rb,
lib/mutant/mutator/node/dstr.rb,
lib/mutant/mutator/node/mlhs.rb,
lib/mutant/mutator/node/when.rb,
lib/mutant/mutator/node/break.rb,
lib/mutant/mutator/node/block.rb,
lib/mutant/mutator/node/masgn.rb,
lib/mutant/mutator/node/const.rb,
lib/mutant/mutator/node/begin.rb,
lib/mutant/ast/named_children.rb,
lib/mutant/mutator/node/splat.rb,
lib/mutant/mutator/node/yield.rb,
lib/mutant/mutator/node/super.rb,
lib/mutant/expression/methods.rb,
lib/mutant/mutator/util/array.rb,
lib/mutant/mutator/util/symbol.rb,
lib/mutant/mutator/node/zsuper.rb,
lib/mutant/selector/expression.rb,
lib/mutant/reporter/cli/format.rb,
lib/mutant/mutator/node/return.rb,
lib/mutant/mutator/node/rescue.rb,
lib/mutant/mutator/node/binary.rb,
lib/mutant/ast/node_predicates.rb,
lib/mutant/mutator/node/nthref.rb,
lib/mutant/mutator/node/define.rb,
lib/mutant/mutator/node/restarg.rb,
lib/mutant/mutator/node/or_asgn.rb,
lib/mutant/reporter/cli/printer.rb,
lib/mutant/mutator/node/kwbegin.rb,
lib/mutant/mutator/node/op_asgn.rb,
lib/mutant/mutator/node/resbody.rb,
lib/mutant/mutator/node/literal.rb,
lib/mutant/mutator/node/defined.rb,
lib/mutant/mutator/node/generic.rb,
lib/mutant/expression/namespace.rb,
lib/mutant/mutator/node/blockarg.rb,
lib/mutant/mutator/node/and_asgn.rb,
lib/mutant/mutator/node/argument.rb,
lib/mutant/mutator/node/arguments.rb,
lib/mutant/subject/method/instance.rb,
lib/mutant/mutator/node/send/index.rb,
lib/mutant/matcher/method/instance.rb,
lib/mutant/mutator/node/literal/nil.rb,
lib/mutant/subject/method/singleton.rb,
lib/mutant/matcher/method/singleton.rb,
lib/mutant/mutator/node/send/binary.rb,
lib/mutant/mutator/node/literal/hash.rb,
lib/mutant/mutator/node/literal/range.rb,
lib/mutant/mutator/node/literal/float.rb,
lib/mutant/mutator/node/literal/array.rb,
lib/mutant/mutator/node/literal/regex.rb,
lib/mutant/mutator/node/literal/string.rb,
lib/mutant/mutator/node/literal/fixnum.rb,
lib/mutant/mutator/node/literal/symbol.rb,
lib/mutant/mutator/node/literal/boolean.rb,
lib/mutant/mutator/node/conditional_loop.rb,
lib/mutant/mutator/node/named_value/access.rb,
lib/mutant/mutator/node/match_current_line.rb,
lib/mutant/mutator/node/send/attribute_assignment.rb,
lib/mutant/mutator/node/named_value/constant_assignment.rb,
lib/mutant/mutator/node/named_value/variable_assignment.rb

Overview

Library namespace

Defined Under Namespace

Modules: AST, Actor, Delegator, Isolation, Meta, Parallel, Result Classes: CLI, Cache, Color, Config, Context, Diff, Env, Expression, Integration, Loader, Matcher, Mutation, Mutator, Reporter, RequireHighjack, Runner, Selector, Subject, Test, WarningFilter, Zombifier

Constant Summary collapse

EMPTY_STRING =

The frozen empty string used within mutant

''.freeze
EMPTY_ARRAY =

The frozen empty array used within mutant

[].freeze
SCOPE_OPERATOR =
'::'.freeze
VERSION =

The current mutant version

'0.7.7'.freeze

Class Method Summary collapse

Class Method Details

.ci?Boolean

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.

Test if CI is detected via environment


40
41
42
# File 'lib/mutant.rb', line 40

def self.ci?
  ENV.key?('CI')
end

.constant_lookup(location) ⇒ Object

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.

Lookup constant for location


52
53
54
55
56
# File 'lib/mutant.rb', line 52

def self.constant_lookup(location)
  location.split(SCOPE_OPERATOR).reduce(Object) do |parent, name|
    parent.const_get(name, nil)
  end
end

.singleton_subclass_instance(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

rubocop:disable MethodLength


80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/mutant.rb', line 80

def self.singleton_subclass_instance(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

.zombifyself

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.

Perform self zombification


64
65
66
67
# File 'lib/mutant.rb', line 64

def self.zombify
  Zombifier.run('mutant', :Zombie)
  self
end