Class: Terraspace::Terraform::Args::Expand

Inherits:
Object
  • Object
show all
Defined in:
lib/terraspace/terraform/args/expand.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mod, options = {}) ⇒ Expand

Returns a new instance of Expand.



19
20
21
# File 'lib/terraspace/terraform/args/expand.rb', line 19

def initialize(mod, options={})
  @mod, @options = mod, options
end

Class Method Details

.option_method(*names) ⇒ Object



4
5
6
7
8
# File 'lib/terraspace/terraform/args/expand.rb', line 4

def option_method(*names)
  names.compact.each do |name|
    option_method_each(name)
  end
end

.option_method_each(name) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/terraspace/terraform/args/expand.rb', line 10

def option_method_each(name)
  define_method name do
    return unless @options[name]
    expander = Terraspace::Compiler::Expander.autodetect(@mod)
    expander.expansion(@options[name]) # pattern is a String that contains placeholders for substitutions
  end
end