struct CLI::Value
- CLI::Value
- Struct
- Value
- Object
Overview
Represents a value for an argument or option.
Defined in:
cli/value.crConstructors
Instance Method Summary
-
#==(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(Type)
Returns the value as an
Array
. -
#as_bool : Bool
Returns the value as a
Bool
. -
#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_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_nil : Nil
Returns the value as
nil
. -
#as_s : String
Returns the value as a
String
. -
#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 size of the value if it is an array or hash, otherwise raises an exception.