Class: Aws::Templates::Utils::Parametrized::Getter::OneOf
- Inherits:
-
Aws::Templates::Utils::Parametrized::Getter
- Object
- Aws::Templates::Utils::Parametrized::Getter
- Aws::Templates::Utils::Parametrized::Getter::OneOf
- Defined in:
- lib/aws/templates/utils/parametrized/getter/one_of.rb
Overview
Pick one of non-nil values returned by nested getters
In general it plays the same role as || operator in Ruby. It just picks first non-nil value returned by a list of getters
Example
class Piece
include Aws::Templates::Utils::Parametrized
parameter :param1, :getter => one_of(
path(:a, :b),
path(:b, :c)
)
end
i = Piece.new( :a => { :b => 3 } )
i.param1 # => 3
i = Piece.new( :b => { :c => 4 } )
i.param1 # => 4
Instance Attribute Summary collapse
-
#getters ⇒ Object
readonly
Returns the value of attribute getters.
Instance Method Summary collapse
-
#initialize(getters) ⇒ OneOf
constructor
A new instance of OneOf.
Methods inherited from Aws::Templates::Utils::Parametrized::Getter
Constructor Details
#initialize(getters) ⇒ OneOf
Returns a new instance of OneOf.
32 33 34 |
# File 'lib/aws/templates/utils/parametrized/getter/one_of.rb', line 32 def initialize(getters) @getters = getters end |
Instance Attribute Details
#getters ⇒ Object (readonly)
Returns the value of attribute getters.
30 31 32 |
# File 'lib/aws/templates/utils/parametrized/getter/one_of.rb', line 30 def getters @getters end |