Class: Cucumber::Core::Test::Result::StrictConfiguration
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Result::StrictConfiguration
- Defined in:
- 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
-
#settings ⇒ Object
writeonly
Sets the attribute settings.
Instance Method Summary collapse
-
#initialize(strict_types = []) ⇒ StrictConfiguration
constructor
A new instance of StrictConfiguration.
- #merge!(other) ⇒ Object
- #set?(type) ⇒ Boolean
- #set_strict(setting, type = nil) ⇒ Object
- #strict?(type = nil) ⇒ Boolean
Constructor Details
#initialize(strict_types = []) ⇒ StrictConfiguration
Returns a new instance of StrictConfiguration.
313 314 315 316 317 318 |
# File 'lib/cucumber/core/test/result.rb', line 313 def initialize(strict_types = []) @settings = STRICT_AFFECTED_TYPES.to_h { |t| [t, :default] } strict_types.each do |type| set_strict(true, type) end end |
Instance Attribute Details
#settings=(value) ⇒ Object
Sets the attribute settings
310 311 312 |
# File 'lib/cucumber/core/test/result.rb', line 310 def settings=(value) @settings = value end |
Instance Method Details
#merge!(other) ⇒ Object
342 343 344 345 346 347 |
# File 'lib/cucumber/core/test/result.rb', line 342 def merge!(other) settings.each_key do |type| set_strict(other.strict?(type), type) if other.set?(type) end self end |
#set?(type) ⇒ Boolean
349 350 351 |
# File 'lib/cucumber/core/test/result.rb', line 349 def set?(type) settings[type] != :default end |
#set_strict(setting, type = nil) ⇒ Object
334 335 336 337 338 339 340 |
# File 'lib/cucumber/core/test/result.rb', line 334 def set_strict(setting, type = nil) if type.nil? STRICT_AFFECTED_TYPES.each { |type| set_strict(setting, type) } else settings[type] = setting end end |
#strict?(type = nil) ⇒ Boolean
320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/cucumber/core/test/result.rb', line 320 def strict?(type = nil) if type.nil? settings.each_value do |value| return true if value == true end false else return false unless settings.key?(type) return false unless set?(type) settings[type] end end |