{"id":20023413,"url":"https://github.com/niku/matchdog","last_synced_at":"2026-05-13T09:32:40.687Z","repository":{"id":66601498,"uuid":"242019387","full_name":"niku/matchdog","owner":"niku","description":"Pattern matching makes ease to dispatch HTTP request","archived":false,"fork":false,"pushed_at":"2023-03-16T04:09:44.000Z","size":9,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T04:17:18.991Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2020-02-21T00:20:11.000Z","updated_at":"2020-02-21T00:20:53.000Z","dependencies_parsed_at":"2023-10-03T21:30:39.295Z","dependency_job_id":null,"html_url":"https://github.com/niku/matchdog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/niku/matchdog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fmatchdog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fmatchdog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fmatchdog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fmatchdog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niku","download_url":"https://codeload.github.com/niku/matchdog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fmatchdog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32976357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T06:31:55.726Z","status":"ssl_error","status_checked_at":"2026-05-13T06:31:51.336Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-11-13T08:46:21.292Z","updated_at":"2026-05-13T09:32:40.671Z","avatar_url":"https://github.com/niku.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Matchdog\n\nMatchdog is:\n\n- a kind of expelimental library to make sure how much useful pattern maching in the wild\n- dispaching HTTP reequest on the rack with using pattern maching\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'matchdog'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install matchdog\n\n## Usage\n\nWrite `config.ru`.\n\n```ruby\n# config.ru\nrequire \"matchdog\"\n\nclass App\n  # When you declare\n  using Matchdog\n  def call(env)\n    # You can apply pattern maching for HTTP request on the rack\n    case env\n      in {REQUEST_METHOD: \"GET\", PATH_INFO: \"/\"}  # matches GET '/'\n      [200, {}, [\"This is the root directory.\"]]\n      in {REQUEST_METHOD: \"GET\", PATH_INFO: path} # macthes GET without '/' and set path data in the request to `path` variable\n      [200, {}, [path]]\n      in {REQUEST_METHOD: \"POST\", \"rack.input\": input} # matches POST and set post data in the request to `input` variable\n      [200, {}, [input.read]]\n    end\n  end\nend\n\nrun App.new\n```\n\nRun `ruckup` command to start HTTP server.\n\n```bash\n❯ bundle exec rackup\n/Users/niku/src/matchdog/config.ru:8: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!\n[2020-02-21 09:07:30] INFO  WEBrick 1.6.0\n[2020-02-21 09:07:30] INFO  ruby 2.7.0 (2019-12-25) [x86_64-darwin18]\n[2020-02-21 09:07:30] INFO  WEBrick::HTTPServer#start: pid=65361 port=9292\n```\n\nTest HTTP request and response\n\n```irb\n❯ bundle exec irb\nirb(main):001:0\u003e require \"net/http\"\n=\u003e true\nirb(main):002:0\u003e Net::HTTP.get(URI.parse(\"http://localhost:9292\"))\n=\u003e \"This is the root directory.\"\nirb(main):003:0\u003e Net::HTTP.get(URI.parse(\"http://localhost:9292/hello\"))\n=\u003e \"/hello\"\nirb(main):004:0\u003e Net::HTTP.post(URI.parse(\"http://localhost:9292\"), \"You will receive this message\").read_body\n=\u003e \"You will receive this message\"\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/niku/matchdog. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/niku/matchdog/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Matchdog project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/niku/matchdog/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniku%2Fmatchdog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniku%2Fmatchdog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniku%2Fmatchdog/lists"}