{"id":26941474,"url":"https://github.com/janlelis/null_plus","last_synced_at":"2026-03-11T13:41:43.195Z","repository":{"id":30321513,"uuid":"33873767","full_name":"janlelis/null_plus","owner":"janlelis","description":"+nil","archived":false,"fork":false,"pushed_at":"2021-01-06T11:01:32.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-04T13:46:04.288Z","etag":null,"topics":["null","nullobject","ruby"],"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/janlelis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-13T14:36:29.000Z","updated_at":"2021-01-06T11:01:31.000Z","dependencies_parsed_at":"2022-08-02T16:45:43.435Z","dependency_job_id":null,"html_url":"https://github.com/janlelis/null_plus","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/janlelis/null_plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fnull_plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fnull_plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fnull_plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fnull_plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janlelis","download_url":"https://codeload.github.com/janlelis/null_plus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fnull_plus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"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":["null","nullobject","ruby"],"created_at":"2025-04-02T16:19:50.558Z","updated_at":"2026-03-11T13:41:43.176Z","avatar_url":"https://github.com/janlelis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# +`nil` [![[version]](https://badge.fury.io/rb/null_plus.svg)](https://badge.fury.io/rb/null_plus) [![[ci]](https://github.com/janlelis/null_plus/workflows/Test/badge.svg)](https://github.com/janlelis/null_plus/actions?query=workflow%3ATest)\n\nThis gem redefines Ruby's unary `+` operator to turn null objects into nil. By default, the unary `+` operator is rarely¹ used by Ruby, so overloading it is not so dangerous as it might have sounded to you when you read it.\n\nEvery object that returns [true for `null?`](https://github.com/janlelis/null_question) is considered a null object.\n\n¹ (Ruby 2.3 introduced `+` for String: It will return an unfrozen version of the string)\n\n## Setup\n\nAdd to your **Gemfile**:\n\n```ruby\ngem \"null_plus\"\n```\n\n## Usage\n\n```ruby\nclass NullObject\n  def null?\n    true\n  end\nend\n\nnull = NullObject.new\n\n+nil #=\u003e nil\n+null #=\u003e nil\n+\"some object\" #=\u003e \"some object\"\n\n# Useful for settings defaults or checking conditions:\nif +null\n  fail # will not run\nend\n\nvalue = +null || 42 #=\u003e 42\n\n```\n\n### Hint\n\nPay attention to proper operator precedence when chaining method class:\n\n```ruby\nclass NullObject\n  def null?\n    true\n  end\nend\n\nnull = NullObject.new\n\n+null.class #=\u003e NullObject\n(+null).class #=\u003e NilClass\n```\n\n## J-_-L\n\nCopyright (C) 2015 Jan Lelis \u003chttps://janlelis.com\u003e. Released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Fnull_plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanlelis%2Fnull_plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Fnull_plus/lists"}