. multimethod
Methods
- .(regexp:RegExp, field:Str)
Get fields of a RegExp. Throws FieldNotFound if field is not one of the allowed values. You should not use this directly. Use "~" and "~~" operators. Parameters
field "options" or "names" Returns
Int for "options". Hash of names/indexes of named groups for "names".Example
/abc/i.options # 1 - case insensitive (C_PCRE_CASELESS) /(?P<name1>abc)/i.names # Name to index Hash: {name1=1}
- .(pa:c_pthread_attr_t, attr:Str)
Get pthread attribute. Currently returns null for unknown attributes. Will throw exceptions in future. Parameters
attr One of: detachstate, guardsize, inheritsched, stacksize.
- .(obj:BasicType, field:Str)
Get BasicType (Int, Arr, Hash, ...) field. Throws FieldNotFound. Automatically called by NGS for syntax
obj.field
Parameters
field Field to get. Currently only "name" and "constructors" are supported. Returns
Str for "name" and MultiMethod for "constructors".Example
Hash.name # String: Hash Hash.constructors # [<NativeMethod Hash>,<UserDefinedMethod Hash at ...>,...]
- .(obj:NormalType, field:Str)
Get NormalType (a type that is typically defined by user) field. Throws FieldNotFound. Automatically called by NGS for syntax
obj.field
Parameters
field Field to get. Currently only "name", "constructors", "parents" and "user" are supported. Returns
Str for "name" and Arr for "constructors".
- .(obj:NormalTypeInstance, field:Str)
Get NormalType (a type that is typically defined by user) instance field. Throws FieldNotFound. Automatically called by NGS for syntax
obj.field
Returns
AnyExample
type T; t=T(); t.x=1; t.x # 1
- .(hl:HashLike, k:Any) Source: stdlib.ngs:702
Get value by key. Throws KeyNotFound. Automatically called by NGS for syntax
your_hashlike.literal_key
Returns
Any
- .(h:Hash, field:Str) Source: stdlib.ngs:1410
Get hash key. Example
h = {"a": 1} h.a # 1, Same as h["a"]
- .(a:Arr, field:Str) Source: stdlib.ngs:1448
Return array made of given field of each element of given array. Will throw KeyNotFound if any of the elements does not have the desired field. Use get() to handle missing field differently. Returns
ArrExample
[{"x": 1}, {"x": 2}].x # [1, 2] [{"x": 1}, {"y": 2}].x # KeyNotFound exeption [{"x": 1}, {"y": 2}].get("x") # [1] - skip [{"x": 1}, {"y": 2}].get("x", null) # [1, null] - use default value
- .(t:Type, field:Str) Source: stdlib.ngs:3725
Undocumented
- .(p:Process, field:Str) Source: stdlib.ngs:4463
Get process "stdout" Parameters
field "stdout" Returns
Str
- .(p:Process, field:Str) Source: stdlib.ngs:4479
Get process "stderr" Parameters
field "stderr" Returns
Str