Egocentric Nil [![[version]](https://badge.fury.io/rb/egonil.svg)](http://badge.fury.io/rb/egonil) [![[ci]](https://github.com/janlelis/egonil/workflows/Test/badge.svg)](https://github.com/janlelis/egonil/actions?query=workflow%3ATest)
January 2, 2021 ยท View on GitHub
Creates a block, where nil does not raise NoMethodErrors
egonil do
nil.some_methods.that[:do].not.exist
end
Further Information
- The Hopelessly Egocentric Blog Post
- The 25 Bytes of Ruby Joy!
- Safe navigation operator
- Null objects with null_question and exists or null_plus
Setup
Add to your Gemfile:
gem 'egonil'
MIT License
Copyright (C) 2010-2016 Jan Lelis https://janlelis.com. Released under the MIT license.