Class: Kitchen::Terraform::Command::InitFactory

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

Overview

InitFactory is the class of objects which build Init objects.

Instance Method Summary collapse

Constructor Details

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

#initialize prepares a new instance of the class

Parameters:

  • version (Gem::Version)

    a client version.



41
42
43
44
# File 'lib/kitchen/terraform/command/init_factory.rb', line 41

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

Instance Method Details

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

#build creates a new instance of an Init object.

Parameters:

  • config (Hash)

    the configuration of the driver.

Returns:



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

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

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