0.0
No commit activity in last 3 years
No release in over 3 years
Turns listed tree to nested hash
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

 Project Readme

ParamsTree

Gem Version Build Status

This is a little helper to turn strings like:

"default(id,user(group(division(name)),name)),post(id,title),comment(id,author,text(title,body))"

to:

{
  "default" => {
    "id" => {},
    "user" => {
      "group" => {
        "division" => {
          "name" => {}
        },
        "name" => {}
      },
      "post" => {
        "id" => {},
        "title" => {}
      },
      "comment" => {
        "id" => {},
        "author" => {},
        "text" => {
          "title" => {},
          "body" => {}
        }
      }
    }
  }
}

Used for rabl-filters

Installation

Add my public key

gem cert --add <(curl -Ls https://raw.github.com/razum2um/params_tree/master/certs/razum2um.pem)

Add this line to your application's Gemfile:

gem 'params_tree'

And then execute:

$ bundle

Or install it yourself as:

$ gem install params_tree                 # without key
$ gem install params_tree -P HighSecurity # secure, with key added

Usage

ParamsTree::Parser.parse(string) # => nested Hash or nil if non-parseable

Contributing

Use rake generate to get a .rb parser, but avoid committing it.

  1. Fork it ( https://github.com/razum2um/params_tree/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