Class: Aws::Templates::Utils::Parametrized::Getter::Value
- Inherits:
-
Aws::Templates::Utils::Parametrized::Getter
- Object
- Aws::Templates::Utils::Parametrized::Getter
- Aws::Templates::Utils::Parametrized::Getter::Value
- Defined in:
- lib/aws/templates/utils/parametrized/getter/value.rb
Overview
Calculate value
If a block is specified, it will be executed in the instance context and return will be used as parameter value. If a value specified then it will be used as parameter value instead.
Example
class Piece
include Aws::Templates::Utils::Parametrized
parameter :param1, :getter => value(1)
parameter :param2, :getter => value { [:z] + 1 }
end
i = Piece.new(:z => 3)
i.param2 # => 4
i.param1 # => 1
Instance Attribute Summary collapse
-
#calculation ⇒ Object
readonly
Returns the value of attribute calculation.
Instance Method Summary collapse
-
#initialize(calculation) ⇒ Value
constructor
A new instance of Value.
Methods inherited from Aws::Templates::Utils::Parametrized::Getter
Constructor Details
#initialize(calculation) ⇒ Value
Returns a new instance of Value.
30 31 32 |
# File 'lib/aws/templates/utils/parametrized/getter/value.rb', line 30 def initialize(calculation) @calculation = calculation end |
Instance Attribute Details
#calculation ⇒ Object (readonly)
Returns the value of attribute calculation.
28 29 30 |
# File 'lib/aws/templates/utils/parametrized/getter/value.rb', line 28 def calculation @calculation end |