Class: Terraspace::Compiler::Expander::Backend
- Inherits:
-
Object
- Object
- Terraspace::Compiler::Expander::Backend
- Extended by:
- Memoist
- Defined in:
- lib/terraspace/compiler/expander/backend.rb
Constant Summary collapse
- COMMENT =
/^\s*#/
Instance Method Summary collapse
-
#detect ⇒ Object
Works for both backend.rb DSL and backend.tf ERB.
-
#initialize(mod) ⇒ Backend
constructor
A new instance of Backend.
Constructor Details
#initialize(mod) ⇒ Backend
Returns a new instance of Backend.
11 12 13 |
# File 'lib/terraspace/compiler/expander/backend.rb', line 11 def initialize(mod) @mod = mod end |
Instance Method Details
#detect ⇒ Object
Works for both backend.rb DSL and backend.tf ERB
17 18 19 20 21 22 23 |
# File 'lib/terraspace/compiler/expander/backend.rb', line 17 def detect return nil unless src_path # no backend file. returning nil means a local backend lines = IO.readlines(src_path) backend_line = lines.find { |l| l.include?("backend") && l !~ COMMENT } md = backend_line.match(/['"](.*)['"]/) md[1] if md end |