decode multimethod

Methods

decode(value:Any, t:Type) Source: stdlib.ngs:1857
Resolve named instance of t by uniquely-identifying value of any field

Example

echo("RED".decode(Color))   # <Color numval=4 name=RED>
decode(s:Str, t:Type)experimental Source: stdlib.ngs:1940
Decode (parse) strings such as command line arguments or environment variables to result given type TODO: Consider renaming to UnArgv or decode_arg
decode(s:Str, p:Any) Source: stdlib.ngs:5480
Decode Path and its subtypes

Returns

instance of Path or a subtype.
decode(s:Str, hints:Hash={}) Source: stdlib.ngs:6593
Attempt to decode JSON. Uses decode_json().
decode(s:Str, hints:Hash) Source: stdlib.ngs:6602
EXPERIMENTAL. KVS (key-value separator) hint for decode()

Example

decode('a b\nc d', {'KVS': ' '}) == {'a': 'b', 'c': 'd'}
decode(s:Str, hints:Hash) Source: stdlib.ngs:6611
EXPERIMENTAL. FS (field separator) hint for decode()

Example

decode('a b\nc d', {'FS': ' '})  # [['a', 'b'], ['c', 'd']]
decode(s:Str, hints:Hash) Source: stdlib.ngs:6621
EXPERIMENTAL! Do not use! Handle fields_names hint - run decode() and make Arr[Hash] from Arr[Arr] using provided fields_names

Example

backup_list = fetch('backup.list', {'FS': ' ', 'fields_names': %[env role]})
decode(s:Str, hints:Hash) Source: stdlib.ngs:6631
Decode "curl -i" to {"code": Int, "message": Str, "headers": Hash, "headers_arr": Hash, "body": Str} .body is not recursively decoded

Returns

Hash
decode(s:Str, hints:Hash) Source: stdlib.ngs:6726
Parse the output of "aws" command. Extracts the array (see "s" below"). For "describe-instances", flattens the instance list.

Parameters

sStr containing JSON with a Hash at top level with exactly one Arr as value
hintshints.process.command.argv[0] must be 'aws'

Returns

data structure, typically an Arr at top level. If s is empty string - null.
decode(s:Str, hints:Hash) Source: stdlib.ngs:6804
Parse the output of "find" command which does not use "-printf". Handles "-print0".

Parameters

hintshints.process.command.argv[0] must be 'find'

Returns

Arr of Str
decode(s:Str, hints:Hash) Source: stdlib.ngs:6815
Parse the output of "locate" command.

Parameters

hintshints.process.command.argv[0] must be 'locate'

Returns

Arr of Str
decode(s:Str, hints:Hash={}) Source: stdlib.ngs:8181
Decodes JSON Web Token (JWT)