Module: Kitchen::Terraform::ConfigPredicates::HashOfSymbolsAndStrings

Includes:
Dry::Logic::Predicates
Defined in:
lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb

Overview

Behaviour to provide a configuration attribute predicate for a hash including only symbol keys and string values.

This module must be declared as providing predicates and extended in a schema’s configuration in order to be used.

Class Method Summary collapse

Class Method Details

.all_strings?(values:) ⇒ ::TrueClass, ::FalseClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

If all values are strings then the result is true; else the result is false.

Parameters:

  • values that must be only strings

Returns:

  • the result

API:

  • private



53
54
55
56
57
58
# File 'lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb', line 53

def self.all_strings?(values:)
  values
    .all? do |value|
      value.kind_of? ::String
    end
end

.all_symbols?(keys:) ⇒ ::TrueClass, ::FalseClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

If all keys are symbols then the result is true; else the result is false.

Parameters:

  • keys that must be only symbols

Returns:

  • the result

API:

  • private



41
42
43
44
45
46
# File 'lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb', line 41

def self.all_symbols?(keys:)
  keys
    .all? do |key|
      key.kind_of? ::Symbol
    end
end