Class: Cucumber::Core::Test::Result::StrictConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strict_types = []) ⇒ StrictConfiguration

Returns a new instance of StrictConfiguration.



284
285
286
287
288
289
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 284

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

Instance Attribute Details

#settings=(value) ⇒ Object

Sets the attribute settings

Parameters:

  • value

    the value to set the attribute settings to.



281
282
283
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 281

def settings=(value)
  @settings = value
end

Instance Method Details

#merge!(other) ⇒ Object



314
315
316
317
318
319
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 314

def merge!(other)
  settings.each_key do |type|
    set_strict(other.strict?(type), type) if other.set?(type)
  end
  self
end

#set?(type) ⇒ Boolean

Returns:

  • (Boolean)


321
322
323
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 321

def set?(type)
  settings[type] != :default
end

#set_strict(setting, type = nil) ⇒ Object



304
305
306
307
308
309
310
311
312
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 304

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) ⇒ Boolean

Returns:

  • (Boolean)


291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 291

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