Class: Mutiny::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mutiny/configuration.rb

Defined Under Namespace

Classes: Mutants, Tests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loads: [], requires: [], patterns: []) ⇒ Configuration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
# File 'lib/mutiny/configuration.rb', line 12

def initialize(loads: [], requires: [], patterns: [])
  @loads = loads
  @requires = requires
  @patterns = patterns
  @patterns.map!(&Pattern.method(:new))

  @reporter = Reporter::Stdout.new
  @mutants = Mutants.new
  @tests = Tests.new
end

Instance Attribute Details

#loadsObject (readonly)

Returns the value of attribute loads.



10
11
12
# File 'lib/mutiny/configuration.rb', line 10

def loads
  @loads
end

#mutantsObject (readonly)

Returns the value of attribute mutants.



10
11
12
# File 'lib/mutiny/configuration.rb', line 10

def mutants
  @mutants
end

#patternsObject (readonly)

Returns the value of attribute patterns.



10
11
12
# File 'lib/mutiny/configuration.rb', line 10

def patterns
  @patterns
end

#reporterObject (readonly)

Returns the value of attribute reporter.



10
11
12
# File 'lib/mutiny/configuration.rb', line 10

def reporter
  @reporter
end

#requiresObject (readonly)

Returns the value of attribute requires.



10
11
12
# File 'lib/mutiny/configuration.rb', line 10

def requires
  @requires
end

#testsObject (readonly)

Returns the value of attribute tests.



10
11
12
# File 'lib/mutiny/configuration.rb', line 10

def tests
  @tests
end

Instance Method Details

#can_load?(source_path) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/mutiny/configuration.rb', line 27

def can_load?(source_path)
  load_paths.any? { |load_path| source_path.start_with?(load_path) }
end

#load_pathsObject



23
24
25
# File 'lib/mutiny/configuration.rb', line 23

def load_paths
  loads.map(&File.method(:expand_path))
end