Class: Kitchen::Terraform::VerifyVersionRescueStrategyFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/terraform/verify_version_rescue_strategy_factory.rb

Overview

VerifyVersionRescueStrategyFactory is the class of objects which build rescue strategies for instances of VerifyVersion.

Instance Method Summary collapse

Constructor Details

#initialize(verify_version:) ⇒ Kitchen::Terraform::VerifyVersionRescueStrategyFactory

#initialize prepares a new instance of the class.

Parameters:

  • verify_version (Boolean)

    a toggle for a strict strategy or a permissive strategy.



42
43
44
# File 'lib/kitchen/terraform/verify_version_rescue_strategy_factory.rb', line 42

def initialize(verify_version:)
  self.verify_version = verify_version
end

Instance Method Details

#build(logger:) ⇒ Kitchen::Terraform::VerifyVersionRescueStrategy::Strict, Kitchen::Terraform::VerifyVersionRescueStrategy::Permissive

#build creates a strategy.

Parameters:

  • logger (Kitchen::Logger)

    a logger to log messages.

Returns:



30
31
32
33
34
35
36
# File 'lib/kitchen/terraform/verify_version_rescue_strategy_factory.rb', line 30

def build(logger:)
  if verify_version
    ::Kitchen::Terraform::VerifyVersionRescueStrategy::Strict.new
  else
    ::Kitchen::Terraform::VerifyVersionRescueStrategy::Permissive.new logger: logger
  end
end