Class: Kitchen::Terraform::FilePathConfigAttributeDefiner

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

Overview

FilePathConfigAttributeDefiner is the class of objects which define a file path configuration attribute on a plugin class.

Instance Method Summary collapse

Constructor Details

#initialize(attribute:, schema:) ⇒ Kitchen::Terraform::FilePathConfigAttributeDefiner

#initialize prepares a new instance of the class.

Parameters:

  • attribute (Kitchen::Terraform::ConfigAttribute)

    an attribute to be defined on a plugin class.

  • schema (Dry::Validation::Schema)

    a schema to use for validation of values of the attribute.



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

def initialize(attribute:, schema:)
  self.attribute = attribute
  self.definer = ::Kitchen::Terraform::ConfigAttributeDefiner.new attribute: attribute, schema: schema
end

Instance Method Details

#define(plugin_class:) ⇒ self

#define defines the file path configuration attribute on a plugin class.

Parameters:

  • plugin_class (Kitchen::ConfigAttributeVerifier)

    a plugin class which has configuration attribute verification behaviour.

Returns:

  • (self)


29
30
31
32
33
34
# File 'lib/kitchen/terraform/file_path_config_attribute_definer.rb', line 29

def define(plugin_class:)
  definer.define plugin_class: plugin_class
  plugin_class.expand_path_for attribute.to_sym

  self
end