Class: Aws::Templates::Utils::Default::Definition::Pair
- Inherits:
-
Aws::Templates::Utils::Default::Definition
- Object
- Aws::Templates::Utils::Default::Definition
- Aws::Templates::Utils::Default::Definition::Pair
- Defined in:
- lib/aws/templates/utils/default.rb
Overview
Definition composition
Pair of definitions which act like one.
Instance Attribute Summary collapse
-
#a ⇒ Object
readonly
Returns the value of attribute a.
-
#b ⇒ Object
readonly
Returns the value of attribute b.
Class Method Summary collapse
Instance Method Summary collapse
- #for(instance) ⇒ Object
-
#initialize(a, b) ⇒ Pair
constructor
A new instance of Pair.
Methods inherited from Aws::Templates::Utils::Default::Definition
empty, from, #merge, #override?, #to_definition
Constructor Details
#initialize(a, b) ⇒ Pair
Returns a new instance of Pair.
178 179 180 181 |
# File 'lib/aws/templates/utils/default.rb', line 178 def initialize(a, b) @a = a.to_definition @b = b.to_definition end |
Instance Attribute Details
#a ⇒ Object (readonly)
Returns the value of attribute a.
175 176 177 |
# File 'lib/aws/templates/utils/default.rb', line 175 def a @a end |
#b ⇒ Object (readonly)
Returns the value of attribute b.
176 177 178 |
# File 'lib/aws/templates/utils/default.rb', line 176 def b @b end |
Class Method Details
.[](a, b) ⇒ Object
156 157 158 159 160 |
# File 'lib/aws/templates/utils/default.rb', line 156 def [](a, b) return b if b.override? || a.override? || a == Definition.empty return a if b.nil? || b == Definition.empty _unite(a, b) end |
Instance Method Details
#for(instance) ⇒ Object
183 184 185 186 187 188 189 190 |
# File 'lib/aws/templates/utils/default.rb', line 183 def for(instance) eval_b = b.for(instance) return eval_b if eval_b.override? && !eval_b.nil? eval_a = a.for(instance) return eval_b if eval_a.override? eval_a.to_definition.merge(eval_b).for(instance) end |