querystring
Parse and stringify HTTP query strings. The Crystal
way! :tada:
Installation
Add this to your application's shard.yml
:
dependencies:
querystring:
github: crystalrealm/querystring
Usage
require "querystring"
QString.parse("?a=2")
# => Hash {"a" => 2}
QString.stringify({"a" => "test", "b" => 2})
# => String "?a=test&b=2"
API
.parse(String)
Parse a query string into a Hash.
The returned object's class equals to Hash(String, Int32 | String | Nil)
.
.stringify(Hash, [options] : Hash)
Stringify a hash into a query string.
The returned object's class equals to String
.
question_mark
Type: boolean
Default: true
Put a question mark (?
) before the query.
Contributing
- Fork it (https://github.com/crystalrealm/querystring/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- szekelymilan Milan Szekely - creator, maintainer