querystring

🔨 querystring library for Crystal

querystring

Open Source Love License PRs Welcome Build Status

Parse and stringify HTTP query strings. The Crystal way! 🎉

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

  1. Fork it (https://github.com/crystalrealm/querystring/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

querystring

Owner
Statistic
  • 2
  • 0
  • 0
  • 0
  • 0
  • about 6 years ago
  • August 28, 2018
License

MIT License

Links
Synced at

Thu, 07 Nov 2024 19:15:57 GMT

Languages