class Kitchen::Terraform::Command::ValidateFactory

ValidateFactory is the class of objects which build Validate objects.

Attributes

requirement[RW]
version[RW]

Public Class Methods

new(version:) click to toggle source

initialize prepares a new instance of the class

@param version [Gem::Version] a client version. @return [Kitchen::Terraform::Command::ValidateFactory]

# 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

Public Instance Methods

build(config:) click to toggle source

build creates a new instance of an Validate object.

@param config [Hash] the configuration of the driver. @return [Kitchen::Terraform::Command::Validate::PreZeroFifteenZero,

Kitchen::Terraform::Command::Validate::PostZeroFifteenZero]
# 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