Class: Terraspace::Terraform::RemoteState::OutputProxy
- Inherits:
-
Object
- Object
- Terraspace::Terraform::RemoteState::OutputProxy
- Defined in:
- lib/terraspace/terraform/remote_state/output_proxy.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
raw: can be anything: String, Array, Hash, etc options: original options passed by user from the output helper in tfvars.
-
#raw ⇒ Object
readonly
raw: can be anything: String, Array, Hash, etc options: original options passed by user from the output helper in tfvars.
Instance Method Summary collapse
-
#initialize(mod, raw, options = {}) ⇒ OutputProxy
constructor
A new instance of OutputProxy.
- #to_ruby ⇒ Object
-
#to_s ⇒ Object
Should always return a String.
Constructor Details
#initialize(mod, raw, options = {}) ⇒ OutputProxy
Returns a new instance of OutputProxy.
6 7 8 9 |
# File 'lib/terraspace/terraform/remote_state/output_proxy.rb', line 6 def initialize(mod, raw, ={}) @mod, @raw, @options = mod, raw, @format = @options[:format] end |
Instance Attribute Details
#options ⇒ Object (readonly)
raw: can be anything: String, Array, Hash, etc options: original options passed by user from the output helper in tfvars
5 6 7 |
# File 'lib/terraspace/terraform/remote_state/output_proxy.rb', line 5 def @options end |
#raw ⇒ Object (readonly)
raw: can be anything: String, Array, Hash, etc options: original options passed by user from the output helper in tfvars
5 6 7 |
# File 'lib/terraspace/terraform/remote_state/output_proxy.rb', line 5 def raw @raw end |
Instance Method Details
#to_ruby ⇒ Object
23 24 25 26 |
# File 'lib/terraspace/terraform/remote_state/output_proxy.rb', line 23 def to_ruby data = @raw.nil? ? mock_or_error : @raw @mod.resolved ? data : Unresolved.new end |
#to_s ⇒ Object
Should always return a String
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/terraspace/terraform/remote_state/output_proxy.rb', line 12 def to_s if @mod.resolved # Dont use Unresolved wrapper because Integer get changed to Strings. # Want raw value to be used for the to_json call value = @raw.nil? ? mock_or_error : @raw value.to_json else Unresolved.new end end |