{"id":15484874,"url":"https://github.com/dblock/with-version","last_synced_at":"2025-09-20T04:32:12.973Z","repository":{"id":56898335,"uuid":"233696892","full_name":"dblock/with-version","owner":"dblock","description":"Syntax sugar for version checks.","archived":false,"fork":false,"pushed_at":"2020-07-16T14:47:07.000Z","size":15,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-26T08:38:14.560Z","etag":null,"topics":[],"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/dblock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-13T21:26:18.000Z","updated_at":"2022-08-09T23:03:49.000Z","dependencies_parsed_at":"2022-08-21T02:20:25.416Z","dependency_job_id":null,"html_url":"https://github.com/dblock/with-version","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dblock/with-version","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fwith-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fwith-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fwith-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fwith-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dblock","download_url":"https://codeload.github.com/dblock/with-version/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fwith-version/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276046889,"owners_count":25575876,"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","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10-02T05:53:18.665Z","updated_at":"2025-09-20T04:32:12.747Z","avatar_url":"https://github.com/dblock.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"With::Version\n==========\n\n[![Gem Version](http://img.shields.io/gem/v/with-version.svg)](http://badge.fury.io/rb/with-version)\n[![Build Status](http://img.shields.io/travis/dblock/with-version.svg)](https://travis-ci.org/dblock/with-version)\n\nSyntax sugar for version checks. Inspired by [usage in hashie](https://github.com/hashie/hashie/search?q=with_minimum_ruby\u0026unscoped_q=with_minimum_ruby).\n\n## Usage\n\n### Ruby::Version\n\nUse `with_minimum_ruby` to check against a Ruby version at class load time, instead of runtime.\n\n```ruby\nrequire 'with-version'\n\nclass Example\n  include With::Version::Ruby\n\n  with_minimum_ruby '2.4.0' do\n    # only declared with Ruby 2.4.0 or newer\n    def dig(*keys)\n      puts \"Digging #{keys.join(', ')} ...\"\n    end\n  end\nend\n```\n\n```ruby\n# Ruby 2.3.0\nundefined method `dig' for #\u003cExample:0x00007fca9388a8a0\u003e (NoMethodError)\n```\n\n```ruby\n# Ruby 2.4.0\nDigging x, y ...\n```\n\nIt will automatically handle pre-release versions differently from when using `Gem::Version`, which is something developers often don't consider.\n\n```ruby\nGem::Version.new('2.4.0.pre') \u003e= Gem::Version.new('2.4.0') # false\n```\n\n```ruby\nrequire 'with-version'\n\nclass Example\n  include With::Version::Ruby\n\n  with_minimum_ruby '2.4.0' do\n    # also true if RUBY_VERSION = 2.4.0.pre\n  end\nend\n```\n\n## Contributing\n\nYou're encouraged to contribute to this gem. See [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Copyright and License\n\nCopyright (c) 2020, Daniel Doubrovkine and [Contributors](CHANGELOG.md).\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdblock%2Fwith-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdblock%2Fwith-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdblock%2Fwith-version/lists"}