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
- #==(*args, **options)
- #==(*args, **options, &)
- #===(*args, **options)
- #===(*args, **options, &)
-
#[](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_a? : Array(String) | Nil
Returns the value as an
Array. -
#as_bool : Bool
Returns the value as a
Bool. -
#as_bool? : Bool | Nil
Returns the value as a
Boolornilif the underlying value is not a boolean. -
#as_dir : Dir
Returns the value as a
Dirobject. -
#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_f? : Float | Nil
Returns the value as a
Floatornilif the underlying value is not a float. -
#as_file : File
Returns the value as a
Fileobject. -
#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_i? : Int | Nil
Returns the value as a
Intornilif the underlying value is not an integer. -
#as_path : Path
Returns the value as a
Pathobject. -
#as_s : String
Returns the value as a
String. -
#as_s? : String | Nil
Returns the value as a
Stringornilif the underlying value is not a string. -
#as_set : Set(String)
Returns the value as a
Set. -
#as_time : Time
Returns the value as a
Timeobject. -
#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_bool : Bool
Converts the value to a
Bool. -
#to_bool? : Bool | Nil
Converts the value to a
BoolorNilif the underlying value cannot be parsed. -
#to_f : Float
Converts the value to a
Float. -
#to_f32 : Float32
Converts the value to a
Float32. -
#to_f32? : Float32 | Nil
Converts the value to a
Float32orNilif the underlying value cannot be parsed. -
#to_f64 : Float64
Converts the value to a
Float64. -
#to_f64? : Float64 | Nil
Converts the value to a
Float64orNilif the underlying value cannot be parsed. -
#to_f? : Float | Nil
Converts the value to a
FloatorNilif the underlying value cannot be parsed. -
#to_i : Int
Conversts the value to an
Int. -
#to_i128 : Int128
Converts the value to an
Int128. -
#to_i128? : Int128 | Nil
Converts the value to an
Int128orNilif the underlying value cannot be parsed. -
#to_i16 : Int16
Converts the value to an
Int16. -
#to_i16? : Int16 | Nil
Converts the value to an
Int16orNilif the underlying value cannot be parsed. -
#to_i32 : Int32
Converts the value to an
Int32. -
#to_i32? : Int32 | Nil
Converts the value to an
Int32orNilif the underlying value cannot be parsed. -
#to_i64 : Int64
Converts the value to an
Int64. -
#to_i64? : Int64 | Nil
Converts the value to an
Int64orNilif the underlying value cannot be parsed. -
#to_i8 : Int8
Converts the value to an
Int8. -
#to_i8? : Int8 | Nil
Converts the value to an
Int8orNilif the underlying value cannot be parsed. -
#to_i? : Int | Nil
Converts the value to an
IntorNilif the underlying value cannot be parsed. - #to_s(*args, **options)
- #to_s(*args, **options, &)
-
#to_u128 : UInt128
Converts the value to a
UInt128. -
#to_u128? : UInt128 | Nil
Converts the value to a
UInt128orNilif the underlying value cannot be parsed. -
#to_u16 : UInt16
Converts the value to a
UInt16. -
#to_u16? : UInt16 | Nil
Converts the value to a
UInt16orNilif the underlying value cannot be parsed. -
#to_u32 : UInt32
Converts the value to a
UInt32. -
#to_u32? : UInt32 | Nil
Converts the value to a
UInt32orNilif the underlying value cannot be parsed. -
#to_u64 : UInt64
Converts the value to a
UInt64. -
#to_u64? : UInt64 | Nil
Converts the value to a
UInt64orNilif the underlying value cannot be parsed. -
#to_u8 : UInt8
Converts the value to a
UInt8. -
#to_u8? : UInt8 | Nil
Converts the value to a
UInt8orNilif the underlying value cannot be parsed.
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 an Array. Note that this does not change the type of the array.
Returns nil if the underlying value is not an array.
Returns the value as a Bool or nil if the underlying value is not a boolean.
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 Float or nil if the underlying value is not a float.
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 Int or nil if the underlying value is not an integer.
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 String or nil if the underlying value is not a string.
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.
Converts the value to a Bool or Nil if the underlying value cannot be parsed.
Converts the value to a Float32 or Nil if the underlying value cannot be parsed.
Converts the value to a Float64 or Nil if the underlying value cannot be parsed.
Converts the value to a Float or Nil if the underlying value cannot be parsed.
Converts the value to an Int128 or Nil if the underlying value cannot be parsed.
Converts the value to an Int16 or Nil if the underlying value cannot be parsed.
Converts the value to an Int32 or Nil if the underlying value cannot be parsed.
Converts the value to an Int64 or Nil if the underlying value cannot be parsed.
Converts the value to an Int8 or Nil if the underlying value cannot be parsed.
Converts the value to an Int or Nil if the underlying value cannot be parsed.
Converts the value to a UInt128 or Nil if the underlying value cannot be parsed.
Converts the value to a UInt16 or Nil if the underlying value cannot be parsed.
Converts the value to a UInt32 or Nil if the underlying value cannot be parsed.
Converts the value to a UInt64 or Nil if the underlying value cannot be parsed.
Converts the value to a UInt8 or Nil if the underlying value cannot be parsed.