Class: Convection::Model::Attributes::Stack
- Inherits:
-
Object
- Object
- Convection::Model::Attributes::Stack
- Defined in:
- lib/convection/model/attributes.rb
Instance Attribute Summary collapse
-
#outputs ⇒ Object
Returns the value of attribute outputs.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#resources ⇒ Object
Returns the value of attribute resources.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #fetch(key, default = nil) ⇒ Object
- #include?(key) ⇒ Boolean
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
12 13 14 15 16 |
# File 'lib/convection/model/attributes.rb', line 12 def initialize @resources = {} @outputs = {} @parameters = {} end |
Instance Attribute Details
#outputs ⇒ Object
Returns the value of attribute outputs.
9 10 11 |
# File 'lib/convection/model/attributes.rb', line 9 def outputs @outputs end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
10 11 12 |
# File 'lib/convection/model/attributes.rb', line 10 def parameters @parameters end |
#resources ⇒ Object
Returns the value of attribute resources.
8 9 10 |
# File 'lib/convection/model/attributes.rb', line 8 def resources @resources end |
Instance Method Details
#[](key) ⇒ Object
30 31 32 |
# File 'lib/convection/model/attributes.rb', line 30 def [](key) @parameters[key.to_s] || @outputs[key.to_s] || @resources[key.to_s] end |
#[]=(key, value) ⇒ Object
34 35 36 |
# File 'lib/convection/model/attributes.rb', line 34 def []=(key, value) @parameters[key.to_s] = value end |
#fetch(key, default = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/convection/model/attributes.rb', line 22 def fetch(key, default = nil) @parameters.fetch(key.to_s) do @outputs.fetch(key.to_s) do @resources.fetch(key.to_s, default) end end end |
#include?(key) ⇒ Boolean
18 19 20 |
# File 'lib/convection/model/attributes.rb', line 18 def include?(key) @parameters.include?(key) || @outputs.include?(key) || @resources.include?(key) end |