Class: Biosphere::ResourceProxy
- Inherits:
-
Object
- Object
- Biosphere::ResourceProxy
show all
- Defined in:
- lib/biosphere/terraformproxy.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ResourceProxy.
43
44
45
46
|
# File 'lib/biosphere/terraformproxy.rb', line 43
def initialize(caller)
@output = {}
@caller = caller
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
98
99
100
|
# File 'lib/biosphere/terraformproxy.rb', line 98
def method_missing(symbol, *args)
return @caller.method(symbol).call(*args)
end
|
Instance Attribute Details
#caller ⇒ Object
Returns the value of attribute caller.
41
42
43
|
# File 'lib/biosphere/terraformproxy.rb', line 41
def caller
@caller
end
|
#output ⇒ Object
Returns the value of attribute output.
40
41
42
|
# File 'lib/biosphere/terraformproxy.rb', line 40
def output
@output
end
|
Instance Method Details
#get(symbol) ⇒ Object
71
72
73
|
# File 'lib/biosphere/terraformproxy.rb', line 71
def get(symbol)
return @output[symbol]
end
|
#id_of(type, name) ⇒ Object
83
84
85
86
87
88
|
# File 'lib/biosphere/terraformproxy.rb', line 83
def id_of(type,name)
if self.name
name = self.name + "_" + name
end
"${#{type}.#{name}.id}"
end
|
#node ⇒ Object
75
76
77
|
# File 'lib/biosphere/terraformproxy.rb', line 75
def node
return @caller.node
end
|
#output_of(type, name, *values) ⇒ Object
90
91
92
93
94
95
96
|
# File 'lib/biosphere/terraformproxy.rb', line 90
def output_of(type, name, *values)
if self.name
name = self.name + "_" + name
end
"${#{type}.#{name}.#{values.join(".")}}"
end
|
#respond_to?(symbol, include_private = false) ⇒ Boolean
48
49
50
|
# File 'lib/biosphere/terraformproxy.rb', line 48
def respond_to?(symbol, include_private = false)
return true
end
|
#set(symbol, value) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/biosphere/terraformproxy.rb', line 52
def set(symbol, value)
if [:ingress, :egress, :route].include?(symbol)
@output[symbol] ||= []
if value.kind_of?(Array)
@output[symbol] += value
else
@output[symbol] << value
end
else
@output[symbol] = value
end
if symbol === :user_data
@output[symbol] = Base64.strict_encode64(Zlib::Deflate.new(nil, 31).deflate(value, Zlib::FINISH))
end
end
|
#state ⇒ Object
79
80
81
|
# File 'lib/biosphere/terraformproxy.rb', line 79
def state
return @caller.state.node
end
|