Class: Kitchen::Terraform::Command::ValidateFactory

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

Overview

ValidateFactory is the class of objects which build Validate objects.

Instance Method Summary collapse

Constructor Details

#initialize(version:) ⇒ Kitchen::Terraform::Command::ValidateFactory

#initialize prepares a new instance of the class

Parameters:

  • version (Gem::Version)

    a client version.



43
44
45
46
# File 'lib/kitchen/terraform/command/validate_factory.rb', line 43

def initialize(version:)
  self.requirement = ::Gem::Requirement.new "< 0.15.0"
  self.version = version
end

Instance Method Details

#build(config:) ⇒ Kitchen::Terraform::Command::Validate::PreZeroFifteenZero, Kitchen::Terraform::Command::Validate::PostZeroFifteenZero

#build creates a new instance of an Validate object.

Parameters:

  • config (Hash)

    the configuration of the driver.

Returns:



31
32
33
34
35
36
37
# File 'lib/kitchen/terraform/command/validate_factory.rb', line 31

def build(config:)
  if requirement.satisfied_by? version
    return ::Kitchen::Terraform::Command::Validate::PreZeroFifteenZero.new config: config
  end

  ::Kitchen::Terraform::Command::Validate::PostZeroFifteenZero.new config: config
end