Class: Mutant::Matcher::Config Private

Inherits:
Object
  • Object
show all
Includes:
Unparser::Adamantium
Defined in:
lib/mutant/matcher/config.rb

Overview

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

Subject matcher configuration

Constant Summary collapse

INSPECT_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.

"#<#{self} %s>".freeze
ATTRIBUTE_DELIMITER =

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.

' '
ATTRIBUTE_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.

'%s: [%s]'
ENUM_DELIMITER =

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.

','
EMPTY_ATTRIBUTES =

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.

'empty'
PRESENTATIONS =

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.

{
  ignore:            :syntax,
  start_expressions: :syntax,
  subjects:          :syntax,
  diffs:             :inspect
}.freeze
DEFAULT =

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.

new(anima.attribute_names.to_h { |name| [name, []] })
LOADER =

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.

Transform::Sequence.new(
  steps: [
    Transform::Hash.new(
      optional: [
        Transform::Hash::Key.new(
          transform: expression_array,
          value:     'subjects'
        ),
        Transform::Hash::Key.new(
          transform: expression_array,
          value:     'ignore'
        )
      ],
      required: []
    ),
    Transform::Hash::Symbolize.new,
    ->(attributes) { Either::Right.new(DEFAULT.with(attributes)) }
  ]
)

Instance Method Summary collapse

Instance Method Details

#add(attribute, value) ⇒ Config

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 value to configurable collection



71
72
73
# File 'lib/mutant/matcher/config.rb', line 71

def add(attribute, value)
  with(attribute => public_send(attribute) + [value])
end

#inspectString

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.

Inspection string



60
61
62
# File 'lib/mutant/matcher/config.rb', line 60

def inspect
  INSPECT_FORMAT % inspect_attributes
end

#merge(other) ⇒ Config

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.

Merge with other config



80
81
82
83
84
85
86
87
# File 'lib/mutant/matcher/config.rb', line 80

def merge(other)
  with(
    ignore:            ignore + other.ignore,
    start_expressions: start_expressions + other.start_expressions,
    subjects:          other.subjects.any? ? other.subjects : subjects,
    diffs:             diffs + other.diffs
  )
end