Methods
Public Instance methods
Any comparison against nil with return -1, except for nil itself which returns 0.
[ show source ]
# File lib/facets/core/nilclass/op_cmp.rb, line 7 def <=>( other ) other.nil? 0 : -1 end
Allows nil to respond to #[]. Always returns nil.
nil[] #=> nil
[ show source ]
# File lib/facets/core/nilclass/op_fetch.rb, line 9 def [](*args) nil end
Allows nil to respond to blank? method. Alwasy returns true.
nil.blank? #=> true
[ show source ]
# File lib/facets/core/nilclass/blank.rb, line 9 def blank? ; true ; end
Allows nil to respond to empty? method. Alwasy returns true.
nil.empty? #=> true
[ show source ]
# File lib/facets/core/nilclass/empty.rb, line 9 def empty? ; true ; end
Allows nil to respond to include? method. Alwasy returns nil.
nil.include?("abc") #=> nil
[ show source ]
# File lib/facets/core/nilclass/include.rb, line 9 def include?(*args); nil; end
Allows nil to respond to length. Always returns 0.
nil.length #=> 0
[ show source ]
# File lib/facets/core/nilclass/size.rb, line 16 def length; 0; end
Allows nil to respond to size. Always returns 0.
nil.size #=> 0
[ show source ]
# File lib/facets/core/nilclass/size.rb, line 9 def size; 0; end
[ show source ]
# File lib/facets/core/nilclass/succ.rb, line 3 def succ; nil; end
[ show source ]
# File lib/facets/core/kernel/to_bool.rb, line 21 def to_bool false end
Allows nil to create an empty hash, similar to to_a and to_s.
nil.to_h #=> {}
[ show source ]
# File lib/facets/core/nilclass/to_h.rb, line 9 def to_h; {}; end