Class: Terraspace::Compiler::Expander
- Inherits:
-
Object
- Object
- Terraspace::Compiler::Expander
- Extended by:
- Memoist
- Defined in:
- lib/terraspace/compiler/expander.rb
Instance Attribute Summary collapse
-
#expander ⇒ Object
readonly
Returns the value of attribute expander.
Class Method Summary collapse
Instance Method Summary collapse
- #expander_class ⇒ Object
-
#initialize(mod, name) ⇒ Expander
constructor
A new instance of Expander.
Constructor Details
#initialize(mod, name) ⇒ Expander
Returns a new instance of Expander.
6 7 8 9 |
# File 'lib/terraspace/compiler/expander.rb', line 6 def initialize(mod, name) @mod, @name = mod, name @expander = .new(@mod) end |
Instance Attribute Details
#expander ⇒ Object (readonly)
Returns the value of attribute expander.
5 6 7 |
# File 'lib/terraspace/compiler/expander.rb', line 5 def @expander end |
Class Method Details
.autodetect(mod, opts = {}) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/terraspace/compiler/expander.rb', line 22 def autodetect(mod, opts={}) backend = opts[:backend] unless backend plugin = find_plugin backend = plugin[:backend] end new(mod, backend) end |
.find_plugin ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/terraspace/compiler/expander.rb', line 32 def find_plugin plugins = Terraspace::Plugin. if plugins.size == 1 plugins.first[1] else precedence = %w[aws azurerm google] plugin = precedence.find do |provider| plugins[provider] end plugins[plugin] end end |
Instance Method Details
#expander_class ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/terraspace/compiler/expander.rb', line 11 def # IE: TerraspacePluginAws::Interfaces::Expander klass_name = Terraspace::Plugin.klass("Expander", backend: @name) klass_name.constantize if klass_name rescue NameError Terraspace::Plugin::Expander::Generic end |