Class: Aws::Templates::Utils::Parametrized::Transformation::AsRendered
- Inherits:
-
Aws::Templates::Utils::Parametrized::Transformation
- Object
- Aws::Templates::Utils::Parametrized::Transformation
- Aws::Templates::Utils::Parametrized::Transformation::AsRendered
- Defined in:
- lib/aws/templates/utils/parametrized/transformation/as_rendered.rb
Overview
Transform value with the specified render
Input value can be anything which could be rendered by the specified render type. Returned value is rendered input.
The transformation is useful when you have a document of some format embedded into a document of another format. An example could be Bash scripts embedded into AWS CFN template.
Example
class Brush
attr_reader :color
attr_reader :thickness
attr_reader :type
def initialize(c, thick, t)
@c = c
@thick = thick
@t = t
end
end
class Circle
attr_reader :radius
attr_reader :brush
def initialize(r, b)
@radius = r
@brush = b
end
end
class Piece
include Aws::Templates::Utils::Parametrized
parameter :picture, :transform => as_rendered(
# Render Type
Graphics::Renders::JPEG,
# parameter section for the render
format: :base64
)
end
i = Piece.new(picture: Circle.new(10, Brush.new(:red, 2, :dots)))
i.picture # => <rendered representation>
Instance Attribute Summary collapse
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(render_type, params) ⇒ AsRendered
constructor
A new instance of AsRendered.
Methods inherited from Aws::Templates::Utils::Parametrized::Transformation
Constructor Details
#initialize(render_type, params) ⇒ AsRendered
Returns a new instance of AsRendered.
59 60 61 62 |
# File 'lib/aws/templates/utils/parametrized/transformation/as_rendered.rb', line 59 def initialize(render_type, params) @type = _check_render_type(render_type) @parameters = params end |
Instance Attribute Details
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
57 58 59 |
# File 'lib/aws/templates/utils/parametrized/transformation/as_rendered.rb', line 57 def parameters @parameters end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
56 57 58 |
# File 'lib/aws/templates/utils/parametrized/transformation/as_rendered.rb', line 56 def type @type end |