Class: AWSCDK::Shims
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Shims
- Defined in:
- shims.rb
Overview
Converts between Mixins and Aspects.
Since Mixins and Aspects are both implementations of the visitor pattern, they can be converted from each other. Mixins are applied immediately (imperative), while Aspects are applied during synthesis (declarative).
Class Method Summary collapse
-
.as_aspect(mixin) ⇒ AWSCDK::IAspect
Wraps a Mixin as an Aspect.
-
.as_mixin(aspect) ⇒ Constructs::IMixin
Wraps an Aspect as a Mixin.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#initialize(*args) ⇒ Shims
constructor
A new instance of Shims.
Constructor Details
#initialize(*args) ⇒ Shims
Returns a new instance of Shims.
12 13 14 |
# File 'shims.rb', line 12 def initialize(*args) raise NoMethodError, "aws-cdk-lib.Shims does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.as_aspect(mixin) ⇒ AWSCDK::IAspect
Wraps a Mixin as an Aspect.
The resulting Aspect defers the Mixin's application to the synthesis phase.
The Mixin's supports() method is used to filter which constructs are visited.
28 29 30 31 |
# File 'shims.rb', line 28 def self.as_aspect(mixin) Jsii::Type.check_type(mixin, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixin") Jsii::Kernel.instance.call_static("aws-cdk-lib.Shims", "asAspect", [mixin]) end |
.as_mixin(aspect) ⇒ Constructs::IMixin
Wraps an Aspect as a Mixin.
The resulting Mixin applies the Aspect's visit() immediately to every node.
The Aspect is applied to all constructs since Aspects don't have a supports() filter.
40 41 42 43 |
# File 'shims.rb', line 40 def self.as_mixin(aspect) Jsii::Type.check_type(aspect, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JQXNwZWN0In0=")), "aspect") Jsii::Kernel.instance.call_static("aws-cdk-lib.Shims", "asMixin", [aspect]) end |
.jsii_overridable_methods ⇒ Object
16 17 18 19 |
# File 'shims.rb', line 16 def self.jsii_overridable_methods { } end |