Class: Mutant::Env::Bootstrap

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/mutant/env/bootstrap.rb

Overview

Boostrap environment

Constant Summary collapse

SEMANTICS_MESSAGE =
"Fix your lib to follow normal ruby semantics!\n" \
'{Module,Class}#name should return resolvable constant name as String or nil'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObject

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.

Initialize object



32
33
34
35
36
# File 'lib/mutant/env/bootstrap.rb', line 32

def initialize(*)
  super
  infect
  initialize_matchable_scopes
end

Instance Attribute Details

#matchable_scopesEnumerable<Matcher::Scope> (readonly)

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.

Scopes that are eligible for matching

Returns:



16
17
18
# File 'lib/mutant/env/bootstrap.rb', line 16

def matchable_scopes
  @matchable_scopes
end

Class Method Details

.new(_config, _cache = Cache.new) ⇒ 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.

New bootstrap env

Returns:



23
24
25
# File 'lib/mutant/env/bootstrap.rb', line 23

def self.new(_config, _cache = Cache.new)
  super
end

Instance Method Details

#envEnv

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.

Environment after bootstraping

rubocop:disable MethodLength

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/mutant/env/bootstrap.rb', line 57

def env
  subjects = matched_subjects
  Env.new(
    actor_env:        Actor::Env.new(Thread),
    config:           config,
    cache:            cache,
    subjects:         subjects,
    matchable_scopes: matchable_scopes,
    integration:      @integration,
    selector:         Selector::Expression.new(@integration),
    mutations:        subjects.flat_map(&:mutations)
  )
end

#warn(message) ⇒ 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.

Print warning message

Parameters:

  • (String)

Returns:

  • (self)


45
46
47
48
# File 'lib/mutant/env/bootstrap.rb', line 45

def warn(message)
  config.reporter.warn(message)
  self
end