class DotPrison::Table
- DotPrison::Table
- Reference
- Object
Overview
AKA a Lua table / HashMap. String keys to String or Table values. Values can also be arrays of Strings or Tables.
Defined in:
dot_prison/builder.crdot_prison/table.cr
dot_prison/to_prison.cr
Class Method Summary
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. - #[](k)
- #[]=(k : Symbol, v)
- #[]=(k, v)
- #[]?(k)
- #add(k : String, v : String) : self
- #add(k : String, v : Table) : self
- #add(k : Symbol, v : String) : self
- #add(k : Symbol, v : Table) : self
- #each(*args, **options)
- #each(*args, **options, &)
- #empty?
-
#parse_bool(key : String | Symbol, default_value : Bool = false) : Bool
Return the
Bool
atkey
. -
#parse_bool!(key : String | Symbol) : Bool
Return the
Bool
atkey
or raises KeyError on non-Bool or missing. -
#parse_bool?(key : String | Symbol) : Bool | Nil
Return the
Bool
atkey
ornil
on non-bool or missing -
#parse_float(key : String | Symbol, default_value : Float64 = 0.0) : Float64
Return the
Float64
atkey
. -
#parse_float!(key : String | Symbol) : Float64
Return the
Float64
atkey
or raises KeyError on non-Float or missing -
#parse_float?(key : String | Symbol) : Float64 | Nil
Return the
Float64
atkey
ornil
on non-Float or missing -
#parse_int(key : String | Symbol, default_value : Int32 = 0) : Int32
Return the
Int32
atkey
. -
#parse_int!(key : String | Symbol) : Int32
Return the
Int32
atkey
or raises KeyError on non-Int or missing -
#parse_int?(key : String | Symbol) : Int32 | Nil
Return the
Int32
atkey
ornil
on non-Int or missing -
#parse_string(key : String | Symbol, default_value : String = "") : String
Return the
String
atkey
. -
#parse_string!(key : String | Symbol) : String
Return the
String
atkey
orKeyError
on non-String or missing -
#parse_string?(key : String | Symbol) : String | Nil
Return the
String
atkey
ornil
on non-String or missing -
#parse_string_array(key : String | Symbol) : Array(String)
Return the
Array(String)
atkey
. -
#parse_string_array!(key : String | Symbol) : Array(String)
Return the
Array(String)
atkey
. -
#parse_string_array?(key : String | Symbol) : Array(String) | Nil
Return the
Array(String)
atkey
. -
#parse_table(key : String | Symbol) : Table
Return the
Table
atkey
. -
#parse_table!(key : String | Symbol) : Table
Return the
Table
atkey
orKeyError
on non-String or missing -
#parse_table?(key : String | Symbol) : Table | Nil
Return the
Table
atkey
ornil
on non-Table or missing -
#parse_table_array(key : String | Symbol) : Array(Table)
Return the
Array(Table)
atkey
. -
#parse_table_array!(key : String | Symbol) : Array(Table)
Return the
Array(Table)
atkey
. -
#parse_table_array?(key : String | Symbol) : Array(Table) | Nil
Return the
Array(Table)
atkey
. - #size
- #to_prison(io : IO, indent = 0)
Instance methods inherited from class Object
to_prison
to_prison
Class Method Detail
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Return the Bool
at key
. On non-Bool or missing value, returns default_value
Return the Bool
at key
or raises KeyError on non-Bool or missing.
Return the Bool
at key
or nil
on non-bool or missing
Return the Float64
at key
. On non-Float or missing value, returns default_value
Return the Float64
at key
or raises KeyError on non-Float or missing
Return the Float64
at key
or nil
on non-Float or missing
Return the Int32
at key
. On non-Int or missing value, returns default_value
Return the Int32
at key
or raises KeyError on non-Int or missing
Return the Int32
at key
or nil
on non-Int or missing
Return the String
at key
. On non-String or missing value, returns default_value
Return the String
at key
or KeyError
on non-String or missing
Return the String
at key
or nil
on non-String or missing
Return the Array(String)
at key
. On String value, replaces the value with
a Array(String) containing the String. On invalid or missing values, a new
Array(String)
is set and returned.
Return the Array(String)
at key
. On String, replaces with an Array(String)
.
Raises KeyError
on other values or missing.
Return the Array(String)
at key
. On String, replaces with an Array(String)
Returns nil on other values or missing.
Return the Table
at key
or KeyError
on non-String or missing
Return the Table
at key
or nil
on non-Table or missing
Return the Array(Table)
at key
. On single Table, replaces the value
with a Array(Table) containing the Table. On invalid or missing values,
a new Array(Table)
is set and returned
Return the Array(Table)
at key
. On Table, replaces with an Array(Table)
.
Raises KeyError
on other values or missing