struct Cling::Value
- Cling::Value
- Struct
- Value
- Object
Overview
Represents a value for an argument or option.
Defined in:
cling/ext.crcling/value.cr
Constructors
Instance Method Summary
-
#==(other : Value) : Bool
:inherit:
-
#==(other : Type) : Bool
:inherit:
-
#[](index : Int32) : Type
Indexes the value if the value is an array, otherwise raises an exception.
-
#[](index : Range) : Type
Attempts to index the value if the value is an array or returns
nil
, otherwise raises an exception. -
#[](key : String) : Type
Indexes the value if the value is a hash, otherwise raises an exception.
-
#[]?(index : Int32) : Type
Attempts to index the value if the value is an array or returns
nil
, otherwise raises an exception. -
#[]?(index : Range) : Type
Attempts to index the value if the value is an array or returns
nil
, otherwise raises an exception. -
#[]?(key : String) : Type | Nil
Attempts to index the value if the value is a hash or returns
nil
, otherwise raises an exception. -
#as_a : Array(String)
Returns the value as an
Array
. -
#as_bool : Bool
Returns the value as a
Bool
. -
#as_dir : Dir
Returns the value as a
Dir
object. -
#as_f : Float
Returns the value as a
Float
. -
#as_f32 : Float32
Returns the value as a
Float"32"
. -
#as_f32? : Float32 | Nil
Returns the value as a
Float"32"
ornil
. -
#as_f64 : Float64
Returns the value as a
Float"64"
. -
#as_f64? : Float64 | Nil
Returns the value as a
Float"64"
ornil
. -
#as_file : File
Returns the value as a
File
object. -
#as_i : Int
Returns the value as an
Int
. -
#as_i128 : Int128
Returns the value as an
Int"128"
. -
#as_i128? : Int128 | Nil
Returns the value as an
Int"128"
ornil
. -
#as_i16 : Int16
Returns the value as an
Int"16"
. -
#as_i16? : Int16 | Nil
Returns the value as an
Int"16"
ornil
. -
#as_i32 : Int32
Returns the value as an
Int"32"
. -
#as_i32? : Int32 | Nil
Returns the value as an
Int"32"
ornil
. -
#as_i64 : Int64
Returns the value as an
Int"64"
. -
#as_i64? : Int64 | Nil
Returns the value as an
Int"64"
ornil
. -
#as_i8 : Int8
Returns the value as an
Int"8"
. -
#as_i8? : Int8 | Nil
Returns the value as an
Int"8"
ornil
. -
#as_path : Path
Returns the value as a
Path
object. -
#as_s : String
Returns the value as a
String
. -
#as_set : Set(String)
Returns the value as a
Set
. -
#as_time : Time
Returns the value as a
Time
object. -
#as_u128 : UInt128
Returns the value as a
UInt"128"
. -
#as_u128? : UInt128 | Nil
Returns the value as a
UInt"128"
ornil
. -
#as_u16 : UInt16
Returns the value as a
UInt"16"
. -
#as_u16? : UInt16 | Nil
Returns the value as a
UInt"16"
ornil
. -
#as_u32 : UInt32
Returns the value as a
UInt"32"
. -
#as_u32? : UInt32 | Nil
Returns the value as a
UInt"32"
ornil
. -
#as_u64 : UInt64
Returns the value as a
UInt"64"
. -
#as_u64? : UInt64 | Nil
Returns the value as a
UInt"64"
ornil
. -
#as_u8 : UInt8
Returns the value as a
UInt"8"
. -
#as_u8? : UInt8 | Nil
Returns the value as a
UInt"8"
ornil
. - #raw : Type
-
#size : Int32
Returns the size of the value if it is an array or hash, otherwise raises an exception.
-
#to_s(io : IO) : Nil
Same as
#inspect(io)
.
Constructor Detail
Instance Method Detail
Indexes the value if the value is an array, otherwise raises an exception.
Attempts to index the value if the value is an array or returns nil
, otherwise raises an
exception.
Indexes the value if the value is a hash, otherwise raises an exception.
Attempts to index the value if the value is an array or returns nil
, otherwise raises an
exception.
Attempts to index the value if the value is an array or returns nil
, otherwise raises an
exception.
Attempts to index the value if the value is a hash or returns nil
, otherwise raises an
exception.
Returns the value as an Array
. Note that this does not change the type of the array.
Returns the value as a Dir
object. Note that this will raise an exception if the directory
is not found.
Returns the value as a File
object. Note that this will raise an exception if the file is
is not found.
Returns the value as a Path
object. This will attempt to resolve the value into a valid
path (see Path.new
).
Returns the value as a Set
. Note that this does not change the type of the set.
Returns the value as a Time
object. This will attempt to parse the value according to the
matching time format, otherwise it will raise an exception (see Time.new
).
Returns the size of the value if it is an array or hash, otherwise raises an exception.