Class: TerraformWrapper::Shared::Code
- Inherits:
-
Object
- Object
- TerraformWrapper::Shared::Code
- Includes:
- Logging
- Defined in:
- lib/terraform-wrapper/shared/code.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #check ⇒ Object
- #exists ⇒ Object
-
#initialize(options:) ⇒ Code
constructor
A new instance of Code.
Methods included from Logging
configure_logger_for, logger_for
Constructor Details
#initialize(options:) ⇒ Code
Returns a new instance of Code.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/terraform-wrapper/shared/code.rb', line 25 def initialize(options:) logger.fatal("Code base path must be a string!") unless ["base"].kind_of?(String) logger.fatal("Code base path must not be blank!") if ["base"].strip.empty? @base = ["base"] logger.fatal("Code component name must be a string!") unless ["name"].kind_of?(String) logger.fatal("Code component name must not be blank!") if ["name"].strip.empty? @name = ["name"] @path = File.join(@base, @name) end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
19 20 21 |
# File 'lib/terraform-wrapper/shared/code.rb', line 19 def base @base end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/terraform-wrapper/shared/code.rb', line 20 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
21 22 23 |
# File 'lib/terraform-wrapper/shared/code.rb', line 21 def path @path end |
Instance Method Details
#check ⇒ Object
41 42 43 |
# File 'lib/terraform-wrapper/shared/code.rb', line 41 def check() return exists end |
#exists ⇒ Object
47 48 49 |
# File 'lib/terraform-wrapper/shared/code.rb', line 47 def exists() return File.directory?(@path) end |