class Crest::EnumeratedFlatParamsEncoder
- Crest::EnumeratedFlatParamsEncoder
- Crest::ParamsEncoder
- Reference
- Object
Direct Known Subclasses
Defined in:
crest/params_encoders/enumerated_flat_params_encoder.crClass Method Summary
- .array_start_index
-
.flatten_params(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))
Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:key2 => "123"}}) # => [{"key1[key2]", "123"}]
-
.flatten_params(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))
Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:arr => ["1", "2", "3"]}}) # => [{"key1[arr][1]", "1"}, {"key1[arr][2]", "2"}, {"key1[arr][3]", "3"}]
Instance Method Summary
-
#encode(params : Hash) : String
Crest::EnumeratedFlatParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1}) # => 'a[1]=one&a[2]=two&a[3]=three&b=true&c=C&d=1'
Instance methods inherited from class Crest::ParamsEncoder
encode(params : Hash) : String
encode
Class methods inherited from class Crest::ParamsEncoder
encode(params : Hash) : String
encode,
flatten_params(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))
flatten_params
Class Method Detail
def self.flatten_params(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))
#
Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:key2 => "123"}})
# => [{"key1[key2]", "123"}]
def self.flatten_params(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))
#
Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:arr => ["1", "2", "3"]}})
# => [{"key1[arr][1]", "1"}, {"key1[arr][2]", "2"}, {"key1[arr][3]", "3"}]
Instance Method Detail
def encode(params : Hash) : String
#
Crest::EnumeratedFlatParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1})
# => 'a[1]=one&a[2]=two&a[3]=three&b=true&c=C&d=1'