Class NilClass
In: lib/facet/nil/[].rb
lib/facet/nil/length.rb
lib/facet/nil/to_f.rb
lib/facet/nil/to_h.rb
lib/facet/nil/empty?.rb
lib/facet/nil/include?.rb
Parent: Object

Methods

[]   blank?   empty?   include?   length   size   to_f   to_h  

Public Instance methods

Allows nil to respond to #[]. Always returns nil.

 require 'facet/nil/[]'

 nil[]   #=> nil

Allows nil to respond to include? method. Alwasy returns nil.

 require 'facet/nil/empty?'

 nil.blank?   #=> true

Allows nil to respond to empty? method. Alwasy returns true.

 require 'facet/nil/empty?'

 nil.empty?   #=> true

Allows nil to respond to include? method. Alwasy returns nil.

 require 'facet/nil/include?'

 nil.include?("abc")   #=> nil

Allows nil to respond to length. Always returns 0.

 require 'facet/nil/length'

 nil.length   #=> 0

Allows nil to respond to size. Always returns 0.

 require 'facet/nil/length'

 nil.length   #=> 0

Returns zero float, similar to to_i.

 require 'facet/nil/to_f'

 nil.to_f   #=> 0.0

Allows nil to create an empty hash, similar to to_a and to_s.

 require 'facet/nil/to_h'

 nil.to_h    #=> {}

[Validate]