Class: AWSCDK::Token
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Token
- Defined in:
- token.rb
Overview
Represents a special or lazily-evaluated value.
Can be used to delay evaluation of a certain value in case, for example, that it requires some context or late-bound data. Can also be used to mark values that need special processing at document rendering time.
Tokens can be embedded into strings while retaining their original semantics.
Class Method Summary collapse
-
.as_any(value) ⇒ AWSCDK::IResolvable
Return a resolvable representation of the given value.
-
.as_list(value, options = nil) ⇒ Array<String>
Return a reversible list representation of this token.
-
.as_number(value) ⇒ Numeric
Return a reversible number representation of this token.
-
.as_string(value, options = nil) ⇒ String
Return a reversible string representation of this token.
-
.compare_strings(possible_token1, possible_token2) ⇒ AWSCDK::TokenComparison
Compare two strings that might contain Tokens with each other.
-
.is_resolved(obj) ⇒ Boolean
The negation of
Token.isUnresolved(). -
.is_unresolved(obj) ⇒ Boolean
Returns true if obj represents an unresolved value.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#initialize(*args) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(*args) ⇒ Token
Returns a new instance of Token.
15 16 17 |
# File 'token.rb', line 15 def initialize(*args) raise NoMethodError, "aws-cdk-lib.Token does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.as_any(value) ⇒ AWSCDK::IResolvable
Return a resolvable representation of the given value.
28 29 30 31 |
# File 'token.rb', line 28 def self.as_any(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value") Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asAny", [value]) end |
.as_list(value, options = nil) ⇒ Array<String>
Return a reversible list representation of this token.
38 39 40 41 42 43 |
# File 'token.rb', line 38 def self.as_list(value, = nil) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value") = .is_a?(Hash) ? ::AWSCDK::EncodingOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5FbmNvZGluZ09wdGlvbnMifQ==")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asList", [value, ]) end |
.as_number(value) ⇒ Numeric
Return a reversible number representation of this token.
49 50 51 52 |
# File 'token.rb', line 49 def self.as_number(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value") Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asNumber", [value]) end |
.as_string(value, options = nil) ⇒ String
Return a reversible string representation of this token.
If the Token is initialized with a literal, the stringified value of the literal is returned. Otherwise, a special quoted string representation of the Token is returned that can be embedded into other strings.
Strings with quoted Tokens in them can be restored back into
complex values with the Tokens restored by calling resolve()
on the string.
67 68 69 70 71 72 |
# File 'token.rb', line 67 def self.as_string(value, = nil) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value") = .is_a?(Hash) ? ::AWSCDK::EncodingOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5FbmNvZGluZ09wdGlvbnMifQ==")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asString", [value, ]) end |
.compare_strings(possible_token1, possible_token2) ⇒ AWSCDK::TokenComparison
Compare two strings that might contain Tokens with each other.
79 80 81 82 83 |
# File 'token.rb', line 79 def self.compare_strings(possible_token1, possible_token2) Jsii::Type.check_type(possible_token1, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "possibleToken1") Jsii::Type.check_type(possible_token2, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "possibleToken2") Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "compareStrings", [possible_token1, possible_token2]) end |
.is_resolved(obj) ⇒ Boolean
The negation of Token.isUnresolved(). In TypeScript, narrows the type to exclude IResolvable.
89 90 91 92 |
# File 'token.rb', line 89 def self.is_resolved(obj) Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj") Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "isResolved", [obj]) end |
.is_unresolved(obj) ⇒ Boolean
Returns true if obj represents an unresolved value.
One of these must be true:
objis an IResolvableobjis a string containing at least one encodedIResolvableobjis either an encoded number or list
This does NOT recurse into lists or objects to see if they contain resolvables.
107 108 109 110 |
# File 'token.rb', line 107 def self.is_unresolved(obj) Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj") Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "isUnresolved", [obj]) end |
.jsii_overridable_methods ⇒ Object
19 20 21 22 |
# File 'token.rb', line 19 def self.jsii_overridable_methods { } end |