class Mutest::Matcher::Config

Subject matcher configuration

Constants

ATTRIBUTE_DELIMITER
ATTRIBUTE_FORMAT
DEFAULT
EMPTY_ATTRIBUTES
ENUM_DELIMITER
INSPECT_FORMAT
PRESENTATIONS

Public Instance Methods

add(attribute, value) click to toggle source

Add value to configurable collection

@param [Symbol] attribute @param [Object] value

@return [Config]

# File lib/mutest/matcher/config.rb, line 40
def add(attribute, value)
  with(attribute => public_send(attribute) + [value])
end
inspect() click to toggle source

Inspection string

@return [String]

# File lib/mutest/matcher/config.rb, line 29
def inspect
  INSPECT_FORMAT % inspect_attributes
end

Private Instance Methods

format_attribute(attribute_name) click to toggle source

Format attribute

@param [Symbol] attribute_name

@return [String]

# File lib/mutest/matcher/config.rb, line 69
def format_attribute(attribute_name)
  format(
    ATTRIBUTE_FORMAT,
    attribute_name,
    public_send(attribute_name)
      .map(&PRESENTATIONS.fetch(attribute_name))
      .join(ENUM_DELIMITER)
  )
end
inspect_attributes() click to toggle source

Formatted attributes

@return [String]

# File lib/mutest/matcher/config.rb, line 56
def inspect_attributes
  attributes = present_attributes
    .map(&method(:format_attribute))
    .join(ATTRIBUTE_DELIMITER)

  attributes.empty? ? EMPTY_ATTRIBUTES : attributes
end
present_attributes() click to toggle source

Present attributes

@return [Array<Symbol>]

# File lib/mutest/matcher/config.rb, line 49
def present_attributes
  to_h.reject { |_key, value| value.empty? }.keys
end