struct Cling::Value

Overview

Represents a value for an argument or option.

Defined in:

cling/ext.cr
cling/value.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(raw : Type) #

[View source]

Instance Method Detail

def ==(other : Value) : Bool #

:inherit:


[View source]
def ==(other : Type) : Bool #

:inherit:


[View source]
def [](index : Int32) : Type #

Indexes the value if the value is an array, otherwise raises an exception.


[View source]
def [](index : Range) : Type #

Attempts to index the value if the value is an array or returns nil, otherwise raises an exception.


[View source]
def [](key : String) : Type #

Indexes the value if the value is a hash, otherwise raises an exception.


[View source]
def []?(index : Int32) : Type #

Attempts to index the value if the value is an array or returns nil, otherwise raises an exception.


[View source]
def []?(index : Range) : Type #

Attempts to index the value if the value is an array or returns nil, otherwise raises an exception.


[View source]
def []?(key : String) : Type | Nil #

Attempts to index the value if the value is a hash or returns nil, otherwise raises an exception.


[View source]
def as_a : Array(String) #

Returns the value as an Array. Note that this does not change the type of the array.


[View source]
def as_bool : Bool #

Returns the value as a Bool.


[View source]
def as_dir : Dir #

Returns the value as a Dir object. Note that this will raise an exception if the directory is not found.


[View source]
def as_f : Float #

Returns the value as a Float.


[View source]
def as_f32 : Float32 #

Returns the value as a Float"32".


[View source]
def as_f32? : Float32 | Nil #

Returns the value as a Float"32" or nil.


[View source]
def as_f64 : Float64 #

Returns the value as a Float"64".


[View source]
def as_f64? : Float64 | Nil #

Returns the value as a Float"64" or nil.


[View source]
def as_file : File #

Returns the value as a File object. Note that this will raise an exception if the file is is not found.


[View source]
def as_i : Int #

Returns the value as an Int.


[View source]
def as_i128 : Int128 #

Returns the value as an Int"128".


[View source]
def as_i128? : Int128 | Nil #

Returns the value as an Int"128" or nil.


[View source]
def as_i16 : Int16 #

Returns the value as an Int"16".


[View source]
def as_i16? : Int16 | Nil #

Returns the value as an Int"16" or nil.


[View source]
def as_i32 : Int32 #

Returns the value as an Int"32".


[View source]
def as_i32? : Int32 | Nil #

Returns the value as an Int"32" or nil.


[View source]
def as_i64 : Int64 #

Returns the value as an Int"64".


[View source]
def as_i64? : Int64 | Nil #

Returns the value as an Int"64" or nil.


[View source]
def as_i8 : Int8 #

Returns the value as an Int"8".


[View source]
def as_i8? : Int8 | Nil #

Returns the value as an Int"8" or nil.


[View source]
def as_path : Path #

Returns the value as a Path object. This will attempt to resolve the value into a valid path (see Path.new).


[View source]
def as_s : String #

Returns the value as a String.


[View source]
def as_set : Set(String) #

Returns the value as a Set. Note that this does not change the type of the set.


[View source]
def as_time : Time #

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).


[View source]
def as_u128 : UInt128 #

Returns the value as a UInt"128".


[View source]
def as_u128? : UInt128 | Nil #

Returns the value as a UInt"128" or nil.


[View source]
def as_u16 : UInt16 #

Returns the value as a UInt"16".


[View source]
def as_u16? : UInt16 | Nil #

Returns the value as a UInt"16" or nil.


[View source]
def as_u32 : UInt32 #

Returns the value as a UInt"32".


[View source]
def as_u32? : UInt32 | Nil #

Returns the value as a UInt"32" or nil.


[View source]
def as_u64 : UInt64 #

Returns the value as a UInt"64".


[View source]
def as_u64? : UInt64 | Nil #

Returns the value as a UInt"64" or nil.


[View source]
def as_u8 : UInt8 #

Returns the value as a UInt"8".


[View source]
def as_u8? : UInt8 | Nil #

Returns the value as a UInt"8" or nil.


[View source]
def raw : Type #

[View source]
def size : Int32 #

Returns the size of the value if it is an array or hash, otherwise raises an exception.


[View source]
def to_s(io : IO) : Nil #

Same as #inspect(io).


[View source]