Class: Aws::Templates::Utils::Parametrized::Getter::Value

Inherits:
Aws::Templates::Utils::Parametrized::Getter show all
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 { options[:z] + 1 }
end

i = Piece.new(:z => 3)
i.param2 # => 4
i.param1 # => 1

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Aws::Templates::Utils::Parametrized::Getter

#get_wrapper, #to_proc

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

#calculationObject (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