0.0
No commit activity in last 3 years
No release in over 3 years
Nil values can be quite annoying. TransparentNil defines some methods for +nil+ so nil values behave like any other object.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.1.27
~> 3.1
~> 3.10
 Project Readme

Transparent Nil¶ ↑

bklippstein.github.com/transparent_nil/frames.html

nil values can be quite annoying. Although it is a nice error indicator but you’re source code gets ugly with too many conditional statements that handle the nil case.  TransparentNil defines some methods for nil so nil values behave like any other object. Most of them return just nil, but some are different:

nil.dup
=> nil

nil[2]
=> nil

nil.empty?
=> true

nil << [element] 
=> [[element]]

nil.size
=> 0

nil.split(//)
=> []

nil <=> 1
=> nil

Think nil als “nothing”. You can ask for nil if you need to, but you don’t have to do it so often.

The Kyanite gem extends the usage of nil.

Usage¶ ↑

require 'transparent_nil'

More Info¶ ↑

Disclaimer¶ ↑

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.