{"id":26967085,"url":"https://github.com/yb66/sinatra-default_parameters","last_synced_at":"2025-04-09T12:41:27.980Z","repository":{"id":6995533,"uuid":"8259653","full_name":"yb66/sinatra-default_parameters","owner":"yb66","description":"Extends the request context with a helper to give a quick and simple way to set defaults for the params helper on a per route basis.","archived":false,"fork":false,"pushed_at":"2018-05-04T18:03:54.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-15T02:46:03.187Z","etag":null,"topics":["par","ruby","sinatra"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yb66.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-18T01:35:21.000Z","updated_at":"2019-02-28T03:00:20.000Z","dependencies_parsed_at":"2022-08-21T00:50:17.612Z","dependency_job_id":null,"html_url":"https://github.com/yb66/sinatra-default_parameters","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yb66%2Fsinatra-default_parameters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yb66%2Fsinatra-default_parameters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yb66%2Fsinatra-default_parameters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yb66%2Fsinatra-default_parameters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yb66","download_url":"https://codeload.github.com/yb66/sinatra-default_parameters/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045220,"owners_count":21038552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["par","ruby","sinatra"],"created_at":"2025-04-03T08:38:34.975Z","updated_at":"2025-04-09T12:41:27.965Z","avatar_url":"https://github.com/yb66.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sinatra Default Parameters #\n\n## Build status ##\n\nMaster branch:\n[![Build Status](https://travis-ci.org/yb66/sinatra-default_parameters.png?branch=master)](https://travis-ci.org/yb66/sinatra-default_parameters)\n\nDevelop branch:\n[![Build Status](https://travis-ci.org/yb66/sinatra-default_parameters.png?branch=develop)](https://travis-ci.org/yb66/sinatra-default_parameters)\n\n## What? ##\n\nA quick and simple way to set defaults for the params helper on a per route basis.\n\n## Why? ##\n\nI was inspired to make this into a gem after [answering this question on StackOverflow](http://stackoverflow.com/a/14885171/335847). I liked the look of it and thought I'll use this again, hence a gem.\n\n## How? ##\n\nIt's quite simple.\n\n    require 'sinatra/default_parameters'\n    \n    helpers Sinatra::DefaultParameters # This too if you're using modular style apps.\n    \n    get \"/\" do\n      set_defaults a: 1, b: 2, c: 3\n      params.inspect\n    end\n    \n    # GET \"/\"\n    # =\u003e {\"a\"=\u003e1, \"b\"=\u003e2, \"c\"=\u003e3}\n    # GET \"/?a=7\u0026b=4\"\n    # =\u003e {\"a\"=\u003e\"7\", \"b\"=\u003e\"4\", \"c\"=\u003e3}\n    # GET \"/?d=4\"\n    # =\u003e {\"a\"=\u003e1, \"b\"=\u003e2, \"c\"=\u003e3, \"d\"=\u003e\"4\"}\n    # GET \"/?a=7\u0026b=4\u0026d=4\"\n    # =\u003e {\"a\"=\u003e\"7\", \"b\"=\u003e\"4\", \"c\"=\u003e3, \"d\"=\u003e\"4\"}\n\nSimples, innit.\n\n***Note:*** As you can see from the examples it doesn't do any type casting or other checks, it just does this one very small thing, the rest is up to you.\n\n\n## Licence ##\n\nSee the LICENCE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyb66%2Fsinatra-default_parameters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyb66%2Fsinatra-default_parameters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyb66%2Fsinatra-default_parameters/lists"}