Class: Mutant::CLI::Builder

Inherits:
Object
  • Object
show all
Includes:
NodeHelpers
Defined in:
lib/mutant/cli.rb

Overview

Builder for configuration components

Constant Summary

Constants included from NodeHelpers

NodeHelpers::INFINITY, NodeHelpers::NAN, NodeHelpers::NEGATIVE_INFINITY, NodeHelpers::N_EMPTY, NodeHelpers::N_FALSE, NodeHelpers::N_NIL, NodeHelpers::N_SELF, NodeHelpers::N_TRUE, NodeHelpers::RAISE

Instance Method Summary collapse

Methods included from NodeHelpers

#n_not, s

Constructor Details

#initializeundefined

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.

Initalize object



45
46
47
48
49
# File 'lib/mutant/cli.rb', line 45

def initialize
  @matchers          = []
  @subject_ignores   = []
  @subject_selectors = []
end

Instance Method Details

#add_matcher(matcher) ⇒ 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.

Add a subject matcher

Parameters:

  • selector (#call)

Returns:

  • (self)


85
86
87
88
# File 'lib/mutant/cli.rb', line 85

def add_matcher(matcher)
  @matchers << matcher
  self
end

#add_subject_ignore(matcher) ⇒ 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.

Add a subject ignore

Parameters:

Returns:

  • (self)


59
60
61
62
# File 'lib/mutant/cli.rb', line 59

def add_subject_ignore(matcher)
  @subject_ignores << matcher
  self
end

#add_subject_selector(selector) ⇒ 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.

Add a subject selector

Parameters:

  • selector (#call)

Returns:

  • (self)


72
73
74
75
# File 'lib/mutant/cli.rb', line 72

def add_subject_selector(selector)
  @subject_selectors << selector
  self
end

#matcherMutant::Matcher

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.

Return generated matcher

Returns:



96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/mutant/cli.rb', line 96

def matcher
  if @matchers.empty?
    raise(Error, 'No patterns given')
  end

  matcher = Matcher::Chain.build(@matchers)

  if predicate
    Matcher::Filter.new(matcher, predicate)
  else
    matcher
  end
end