{"id":15032777,"url":"https://github.com/ruby/cgi","last_synced_at":"2025-05-15T12:06:52.947Z","repository":{"id":37949047,"uuid":"200769358","full_name":"ruby/cgi","owner":"ruby","description":"CGI is a large class, providing several categories of methods, many of which are mixed in from other modules. ","archived":false,"fork":false,"pushed_at":"2025-05-12T03:36:36.000Z","size":803,"stargazers_count":37,"open_issues_count":14,"forks_count":25,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-05-12T04:32:40.804Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-08-06T03:27:20.000Z","updated_at":"2025-05-12T03:36:39.000Z","dependencies_parsed_at":"2024-06-18T15:28:24.897Z","dependency_job_id":"720ff101-dca1-4e71-9d3b-05890ef7617a","html_url":"https://github.com/ruby/cgi","commit_stats":{"total_commits":444,"total_committers":41,"mean_commits":"10.829268292682928","dds":0.7927927927927928,"last_synced_commit":"af9d8f10c7c89b6b1d51a21d5a331109cae7fd12"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fcgi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fcgi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fcgi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fcgi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby","download_url":"https://codeload.github.com/ruby/cgi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253678843,"owners_count":21946314,"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":[],"created_at":"2024-09-24T20:19:25.976Z","updated_at":"2025-05-15T12:06:47.929Z","avatar_url":"https://github.com/ruby.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Introduction\n\nCGI is a large class, providing several categories of methods, many of which\nare mixed in from other modules.  Some of the documentation is in this class,\nsome in the modules CGI::QueryExtension and CGI::HtmlExtension.  See\nCGI::Cookie for specific information on handling cookies, and cgi/session.rb\n(CGI::Session) for information on sessions.\n\nFor queries, CGI provides methods to get at environmental variables,\nparameters, cookies, and multipart request data.  For responses, CGI provides\nmethods for writing output and generating HTML.\n\nRead on for more details.  Examples are provided at the bottom.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'cgi'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install cgi\n\n## Usage\n\n### Get form values\n\nGiven a form with the content `field_name=123`:\n\n```ruby\nrequire \"cgi\"\ncgi = CGI.new\nvalue = cgi['field_name'] # =\u003e \"123\"\ncgi['flowerpot'] # =\u003e \"\"\nfields = cgi.keys # =\u003e [ \"field_name\" ]\n\ncgi.has_key?('field_name') # =\u003e true\ncgi.include?('field_name') # =\u003e true\ncgi.include?('flowerpot') # =\u003e false\n```\n\n### Get form values as hash\n\n```ruby\nrequire \"cgi\"\ncgi = CGI.new\nparams = cgi.params\n```\n\ncgi.params is a hash.\n\n```ruby\ncgi.params['new_field_name'] = [\"value\"]  # add new param\ncgi.params['field_name'] = [\"new_value\"]  # change value\ncgi.params.delete('field_name')           # delete param\ncgi.params.clear                          # delete all params\n```\n\n### Save form values to file\n\n```ruby\nrequire \"pstore\"\ndb = PStore.new(\"query.db\")\ndb.transaction do\n  db[\"params\"] = cgi.params\nend\n```\n\n\n### Restore form values from file\n\n```ruby\nrequire \"pstore\"\ndb = PStore.new(\"query.db\")\ndb.transaction do\n  cgi.params = db[\"params\"]\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ruby/cgi.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fcgi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby%2Fcgi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fcgi/lists"}