Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/null.rb
Instance Method Summary collapse
-
#! ⇒ Object
This is an alias for
falsy?
. -
#falsy? ⇒ Boolean
falsy?
istrue
iff we arenil
,false
, or an instance of NullClass. -
#null? ⇒ Boolean
Are we
null
?. -
#tap? {|_self| ... } ⇒ Boolean
obj.tap?() is equivalent to obj.tap() unless
obj
is an instance of NullClass, in which case a block must still be given, but will not be executed. -
#to_nil? ⇒ Boolean
null.to_nil?
returnsnil
; everything else returnsself
. -
#truthy? ⇒ Boolean
truthy?
isfalse
iff we arenil
,false
, or an instance of NullClass.
Instance Method Details
#falsy? ⇒ Boolean
falsy?
is true
iff we are nil
, false
, or an instance of NullClass.
8 9 10 |
# File 'lib/null.rb', line 8 def falsy? false end |
#null? ⇒ Boolean
Are we null
?
18 19 20 |
# File 'lib/null.rb', line 18 def null? false end |
#tap? {|_self| ... } ⇒ Boolean
obj.tap?() is equivalent to obj.tap() unless obj
is an instance of NullClass, in which case a block must still be given, but will not be executed.
30 31 32 33 |
# File 'lib/null.rb', line 30 def tap? # yield: self yield(self) self end |
#to_nil? ⇒ Boolean
null.to_nil?
returns nil
; everything else returns self
.
23 24 25 |
# File 'lib/null.rb', line 23 def to_nil?() self end |
#truthy? ⇒ Boolean
truthy?
is false
iff we are nil
, false
, or an instance of NullClass.
3 4 5 |
# File 'lib/null.rb', line 3 def truthy? true end |