Class: Convection::Model::Attributes::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/convection/model/attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStack

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

#outputsObject

Returns the value of attribute outputs.



9
10
11
# File 'lib/convection/model/attributes.rb', line 9

def outputs
  @outputs
end

#parametersObject (readonly)

Returns the value of attribute parameters.



10
11
12
# File 'lib/convection/model/attributes.rb', line 10

def parameters
  @parameters
end

#resourcesObject

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

Returns:

  • (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