{"id":28509116,"url":"https://github.com/atomicobject/require_options","last_synced_at":"2026-02-19T18:05:05.316Z","repository":{"id":795132,"uuid":"493747","full_name":"atomicobject/require_options","owner":"atomicobject","description":"Enforces key requirements in a hash","archived":false,"fork":false,"pushed_at":"2012-10-09T03:30:48.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-11-10T13:25:46.249Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.atomicobject.com/pages/Software+Commons","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/atomicobject.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-01-29T15:39:25.000Z","updated_at":"2013-12-18T00:36:27.000Z","dependencies_parsed_at":"2022-08-16T10:55:14.875Z","dependency_job_id":null,"html_url":"https://github.com/atomicobject/require_options","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/atomicobject/require_options","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Frequire_options","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Frequire_options/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Frequire_options/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Frequire_options/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atomicobject","download_url":"https://codeload.github.com/atomicobject/require_options/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Frequire_options/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29626657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T18:02:07.722Z","status":"ssl_error","status_checked_at":"2026-02-19T18:01:46.144Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2025-06-08T22:07:28.788Z","updated_at":"2026-02-19T18:05:05.296Z","avatar_url":"https://github.com/atomicobject.png","language":"Ruby","readme":"== Description\nSimply extract named arguments from a hash.  Require or allow a set of keys.\n\n== Rationale\nWhen using hashes to accomplish named-argument semantics for methods, we\nnoticed a common pattern:\n\n* We often pull options out into local vars at the head of a method\n* We often raise argument errors for missing keys in the hash\n\nRequireOptions accomplishes both tasks succinctly.\n\n== Install\n  script/plugin git://github.com/atomicobject/require_options.git\n\nor\n\n  gem install require_options\n  \n== Example\n  class Car\n    include RequireOptions    \n\n    def drive(opts)\n      gear, speed = require_options(opts, :speed, :gear) \n      # opts \n    end    \n\n    def put_in_trunk(opts)\n      allow_options opts, :flare, :tire, :luggage\n      # opts may contain any and all of the named keys, but no others\n    end\n\n    def register(opts)\n      require_at_least_one opts, :license, :ssn\n      # This method wants to use either opts[:license] OR opts[:ssn]\n    end\n\n    def park(opts)\n      filter_options(opts, :spot)\n      # filter out keys besides :spot, for security purposes, e.g.\n    end\n  end\n\n== Authors\n\n* Justin DeWind (dewind@atomicobject.com)\n* David Crosby (crosby@atomicobject.com)\n* © 2009-2011 {Atomic Object}[http://www.atomicobject.com]\n* More Atomic Object {open source}[http://www.atomicobject.com/pages/Software+Commons] projects\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomicobject%2Frequire_options","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomicobject%2Frequire_options","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomicobject%2Frequire_options/lists"}