Skip to content

janlelis/null_question

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Object#null? [version] [ci]

Adds NilClass#null? #=> true and Object#null? #=> false

Useful for implementing custom null objects that will also return true for #null?

Setup

Add to your Gemfile:

gem 'null_question'

Usage

class NullObject
  def null?
    true
  end
end

nil.null? #=> true
NullObject.new.null? #=> true
Object.new.null? #=> false

J-_-L

Copyright (C) 2015 Jan Lelis https://janlelis.com. Released under the MIT license.

About

Adds the null? predicate to Ruby's nil

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages