class Cucumber::Core::Test::Result::StrictConfiguration

Handles the strict settings for the result types that are affected by the strict options (that is the STRICT_AFFECTED_TYPES).

Attributes

settings[RW]

Public Class Methods

new(strict_types = []) click to toggle source
# File lib/cucumber/core/test/result.rb, line 282
def initialize(strict_types = [])
  @settings = STRICT_AFFECTED_TYPES.map { |t| [t, :default] }.to_h
  strict_types.each do |type|
    set_strict(true, type)
  end
end

Public Instance Methods

merge!(other) click to toggle source
# File lib/cucumber/core/test/result.rb, line 312
def merge!(other)
  settings.each_key do |type|
    set_strict(other.strict?(type), type) if other.set?(type)
  end
  self
end
set?(type) click to toggle source
# File lib/cucumber/core/test/result.rb, line 319
def set?(type)
  settings[type] != :default
end
set_strict(setting, type = nil) click to toggle source
# File lib/cucumber/core/test/result.rb, line 302
def set_strict(setting, type = nil)
  if type.nil?
    STRICT_AFFECTED_TYPES.each do |t|
      set_strict(setting, t)
    end
  else
    settings[type] = setting
  end
end
strict?(type = nil) click to toggle source
# File lib/cucumber/core/test/result.rb, line 289
def strict?(type = nil)
  if type.nil?
    settings.each do |_key, value|
      return true if value == true
    end
    false
  else
    return false unless settings.key?(type)
    return false unless set?(type)
    settings[type]
  end
end