struct Secrets::Any
- Secrets::Any
- Struct
- Value
- Object
Defined in:
secrets/any.crConstructors
- .from_yaml(yaml : String) : Any
- .new(raw : Type)
-
.new(array : Array(String))
Creates an
Any
that wraps the givenArray
of Strings. -
.new(hash : Hash(String, String))
Creates an
Any
that wraps the givenHash
of Strings. -
.new(any : YAML::Any)
Creates an
Any
from the raw value of aYAML::Any
.
Instance Method Summary
-
#[](index_or_key : Int32 | String) : Any
Assumes the underlying value is an
Array
orHash
and returns the element at the given index_or_key. -
#[]=(index_or_key : Int32 | String, value : Type)
Assumes the underlying value is an
Array
orHash
and assigns a value at the given index_or_key. -
#[]?(index_or_key : Int32 | String) : Any | Nil
Assumes the underlying value is an
Array
orHash
and returns the element at the given index_or_key, ornil
if out of bounds or the key is missing. -
#as_a : Array(String)
Checks that the underlying value is
Array(String)
, and returns its value. -
#as_a? : Array(String) | Nil
Checks that the underlying value is
Array(String)
, and returns its value. -
#as_h : Hash(String, String)
Checks that the underlying value is
Hash(String, String)
, and returns its value. -
#as_h? : Hash(String, String) | Nil
Checks that the underlying value is
Hash(String, String)
, and returns its value. -
#as_s : String
Checks that the underlying value is
String
, and returns its value. -
#as_s? : String | Nil
Checks that the underlying value is
String
, and returns its value. -
#raw : Type
The raw underlying value, a
Type
. - #to_yaml(yaml : YAML::Nodes::Builder)
Constructor Detail
Instance Method Detail
Assumes the underlying value is an Array
or Hash
and returns the element at the given index_or_key.
Raises if the underlying value is not an Array
nor a Hash
.
Assumes the underlying value is an Array
or Hash
and assigns a value at the given index_or_key.
Raises if the underlying value is not an Array
nor a Hash
.
Assumes the underlying value is an Array
or Hash
and returns the element
at the given index_or_key, or nil
if out of bounds or the key is missing.
Raises if the underlying value is not an Array
nor a Hash
.
Checks that the underlying value is Array(String)
, and returns its value.
Raises otherwise.
Checks that the underlying value is Array(String)
, and returns its value.
Returns nil
otherwise.
Checks that the underlying value is Hash(String, String)
, and returns its value.
Raises otherwise.
Checks that the underlying value is Hash(String, String)
, and returns its value.
Returns nil
otherwise.
Checks that the underlying value is String
, and returns its value.
Raises otherwise.
Checks that the underlying value is String
, and returns its value.
Returns nil
otherwise.