Class: AWSCDK::Lazy
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Lazy
- Defined in:
- lazy.rb
Overview
Lazily produce a value.
Can be used to return a string, list or numeric value whose actual value will only be calculated later, during synthesis.
Class Method Summary collapse
-
.any(producer, options = nil) ⇒ AWSCDK::IResolvable
Defer the one-time calculation of an arbitrarily typed value to synthesis time.
- .jsii_overridable_methods ⇒ Object
-
.list(producer, options = nil) ⇒ Array<String>
Defer the one-time calculation of a list value to synthesis time.
-
.number(producer) ⇒ Numeric
Defer the one-time calculation of a number value to synthesis time.
-
.string(producer, options = nil) ⇒ String
Defer the one-time calculation of a string value to synthesis time.
-
.uncached_any(producer, options = nil) ⇒ AWSCDK::IResolvable
Defer the calculation of an untyped value to synthesis time.
-
.uncached_list(producer, options = nil) ⇒ Array<String>
Defer the calculation of a list value to synthesis time.
-
.uncached_number(producer) ⇒ Numeric
Defer the calculation of a number value to synthesis time.
-
.uncached_string(producer, options = nil) ⇒ String
Defer the calculation of a string value to synthesis time.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Lazy
constructor
A new instance of Lazy.
Constructor Details
#initialize(*args) ⇒ Lazy
Returns a new instance of Lazy.
11 12 13 |
# File 'lazy.rb', line 11 def initialize(*args) raise NoMethodError, "aws-cdk-lib.Lazy does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.any(producer, options = nil) ⇒ AWSCDK::IResolvable
Defer the one-time calculation of an arbitrarily typed value to synthesis time.
Use this if you want to render an object to a template whose actual value depends on some state mutation that may happen after the construct has been created.
The inner function will only be invoked one time and cannot depend on resolution context.
31 32 33 34 35 36 |
# File 'lazy.rb', line 31 def self.any(producer, = nil) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlQW55UHJvZHVjZXIifQ==")), "producer") = .is_a?(Hash) ? ::AWSCDK::LazyAnyValueOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5QW55VmFsdWVPcHRpb25zIn0=")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "any", [producer, ]) end |
.jsii_overridable_methods ⇒ Object
15 16 17 18 |
# File 'lazy.rb', line 15 def self.jsii_overridable_methods { } end |
.list(producer, options = nil) ⇒ Array<String>
Defer the one-time calculation of a list value to synthesis time.
Use this if you want to render a list to a template whose actual value depends on some state mutation that may happen after the construct has been created.
If you are simply looking to force a value to a string[] type and don't need
the calculation to be deferred, use Token.asList() instead.
The inner function will only be invoked once, and the resolved value cannot depend on the Stack the Token is used in.
52 53 54 55 56 57 |
# File 'lazy.rb', line 52 def self.list(producer, = nil) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlTGlzdFByb2R1Y2VyIn0=")), "producer") = .is_a?(Hash) ? ::AWSCDK::LazyListValueOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5TGlzdFZhbHVlT3B0aW9ucyJ9")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "list", [producer, ]) end |
.number(producer) ⇒ Numeric
Defer the one-time calculation of a number value to synthesis time.
Use this if you want to render a number to a template whose actual value depends on some state mutation that may happen after the construct has been created.
If you are simply looking to force a value to a number type and don't need
the calculation to be deferred, use Token.asNumber() instead.
The inner function will only be invoked once, and the resolved value cannot depend on the Stack the Token is used in.
72 73 74 75 |
# File 'lazy.rb', line 72 def self.number(producer) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlTnVtYmVyUHJvZHVjZXIifQ==")), "producer") Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "number", [producer]) end |
.string(producer, options = nil) ⇒ String
Defer the one-time calculation of a string value to synthesis time.
Use this if you want to render a string to a template whose actual value depends on some state mutation that may happen after the construct has been created.
If you are simply looking to force a value to a string type and don't need
the calculation to be deferred, use Token.asString() instead.
The inner function will only be invoked once, and the resolved value cannot depend on the Stack the Token is used in.
91 92 93 94 95 96 |
# File 'lazy.rb', line 91 def self.string(producer, = nil) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlU3RyaW5nUHJvZHVjZXIifQ==")), "producer") = .is_a?(Hash) ? ::AWSCDK::LazyStringValueOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5U3RyaW5nVmFsdWVPcHRpb25zIn0=")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "string", [producer, ]) end |
.uncached_any(producer, options = nil) ⇒ AWSCDK::IResolvable
Defer the calculation of an untyped value to synthesis time.
Use of this function is not recommended; unless you know you need it for sure, you
probably don't. Use Lazy.any() instead.
The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.
112 113 114 115 116 117 |
# File 'lazy.rb', line 112 def self.uncached_any(producer, = nil) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JQW55UHJvZHVjZXIifQ==")), "producer") = .is_a?(Hash) ? ::AWSCDK::LazyAnyValueOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5QW55VmFsdWVPcHRpb25zIn0=")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedAny", [producer, ]) end |
.uncached_list(producer, options = nil) ⇒ Array<String>
Defer the calculation of a list value to synthesis time.
Use of this function is not recommended; unless you know you need it for sure, you
probably don't. Use Lazy.list() instead.
The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.
133 134 135 136 137 138 |
# File 'lazy.rb', line 133 def self.uncached_list(producer, = nil) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JTGlzdFByb2R1Y2VyIn0=")), "producer") = .is_a?(Hash) ? ::AWSCDK::LazyListValueOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5TGlzdFZhbHVlT3B0aW9ucyJ9")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedList", [producer, ]) end |
.uncached_number(producer) ⇒ Numeric
Defer the calculation of a number value to synthesis time.
Use of this function is not recommended; unless you know you need it for sure, you
probably don't. Use Lazy.number() instead.
The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.
153 154 155 156 |
# File 'lazy.rb', line 153 def self.uncached_number(producer) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JTnVtYmVyUHJvZHVjZXIifQ==")), "producer") Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedNumber", [producer]) end |
.uncached_string(producer, options = nil) ⇒ String
Defer the calculation of a string value to synthesis time.
Use of this function is not recommended; unless you know you need it for sure, you
probably don't. Use Lazy.string() instead.
The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.
172 173 174 175 176 177 |
# File 'lazy.rb', line 172 def self.uncached_string(producer, = nil) Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RyaW5nUHJvZHVjZXIifQ==")), "producer") = .is_a?(Hash) ? ::AWSCDK::LazyStringValueOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5U3RyaW5nVmFsdWVPcHRpb25zIn0=")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedString", [producer, ]) end |