module Crest::ParamsDecoder

Overview

Module for decoding query-string into parameters.

Extended Modules

Defined in:

crest/params_decoder.cr

Constant Summary

ARRAY_REGEX = /[\[\]]+\Z/
SUBKEYS_REGEX = /[^\[\]]+(?:\]?\[\])?/

Instance Method Summary

Instance Method Detail

def decode(query : String) : Hash(String, Type) #

Converts the given URI query string into a hash.

Crest::ParamsDecoder.decode("a[]=one&a[]=two&a[]=three&b=true&c=C&d=1")
# => {"a" => ["one", "two", "three"], "b" => "true", "c" => "C", "d" => "1"}

Crest::ParamsDecoder.decode("a=one&a=two&a=three&b=true&c=C&d=1")
# => {"a" => ["one", "two", "three"], "b" => "true", "c" => "C", "d" => "1"}

[View source]
def match_context(context, subkey) : Type | Nil #

[View source]