Module: Mutant::Bootstrap Private

Includes:
Adamantium::Flat
Defined in:
lib/mutant/bootstrap.rb

Overview

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

Bootstrap process

The role of the boostrap is to take the pure config and apply it against the impure world to produce an environment.

env = config interpreted against the world

Constant Summary collapse

SEMANTICS_MESSAGE_FORMAT =

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

"%<message>s. Fix your lib to follow normal ruby semantics!\n" \
'{Module,Class}#name should return resolvable constant name as String or nil'
CLASS_NAME_RAISED_EXCEPTION =

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

'%<scope_class>s#name from: %<scope>s raised an error: %<exception>s'
CLASS_NAME_TYPE_MISMATCH_FORMAT =

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

'%<scope_class>s#name from: %<scope>s returned %<name>s'

Class Method Summary collapse

Class Method Details

.apply(world, config) ⇒ Either<String, Env>

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.

Run Bootstrap

rubocop:disable Metrics/MethodLength

Parameters:

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/mutant/bootstrap.rb', line 33

def self.apply(world, config)
  env = Env
    .empty(world, config)
    .tap(&method(:infect))
    .with(matchable_scopes: matchable_scopes(world, config))

  subjects = start_subject(env, Matcher.from_config(env.config.matcher).call(env))

  Integration.setup(env).fmap do |integration|
    env.with(
      integration: integration,
      mutations:   subjects.flat_map(&:mutations),
      selector:    Selector::Expression.new(integration),
      subjects:    subjects
    )
  end
end