Class: Biosphere::ResourceProxy
- Inherits:
-
Object
- Object
- Biosphere::ResourceProxy
- Defined in:
- lib/biosphere/terraformproxy.rb
Instance Attribute Summary collapse
-
#caller ⇒ Object
readonly
Returns the value of attribute caller.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(caller) ⇒ ResourceProxy
constructor
A new instance of ResourceProxy.
- #method_missing(symbol, *args) ⇒ Object
- #respond_to?(symbol, include_private = false) ⇒ Boolean
Constructor Details
#initialize(caller) ⇒ ResourceProxy
Returns a new instance of ResourceProxy.
38 39 40 41 |
# File 'lib/biosphere/terraformproxy.rb', line 38 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
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/biosphere/terraformproxy.rb', line 48 def method_missing(symbol, *args) #puts ">>>>>>>> method missing: #{symbol}, #{args}" if @caller.methods.include?(symbol) return @caller.method(symbol).call(*args) end # Support getter here if args.length == 0 return @output[symbol] end # Support setter here if [:ingress, :egress, :route].include?(symbol) @output[symbol] ||= [] if args[0].kind_of?(Array) @output[symbol] += args[0] else @output[symbol] << args[0] end else @output[symbol] = args[0] end end |
Instance Attribute Details
#caller ⇒ Object (readonly)
Returns the value of attribute caller.
36 37 38 |
# File 'lib/biosphere/terraformproxy.rb', line 36 def caller @caller end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
35 36 37 |
# File 'lib/biosphere/terraformproxy.rb', line 35 def output @output end |
Instance Method Details
#respond_to?(symbol, include_private = false) ⇒ Boolean
44 45 46 |
# File 'lib/biosphere/terraformproxy.rb', line 44 def respond_to?(symbol, include_private = false) return true end |