Module: Mongoid::Extensions::NilClass

Defined in:
lib/mongoid/extensions/nil_class.rb

Overview

Adds type-casting behavior to NilClass.

Instance Method Summary collapse

Instance Method Details

#__setter__nil

Deprecated.

Try to form a setter from this object.

Examples:

Try to form a setter.

object.__setter__

Returns:

  • (nil)

    Always nil.



15
16
17
# File 'lib/mongoid/extensions/nil_class.rb', line 15

def __setter__
  self
end

#collectionizeString

Get the name of a nil collection.

Examples:

Get the nil name.

nil.collectionize

Returns:

  • (String)

    A blank string.



26
27
28
# File 'lib/mongoid/extensions/nil_class.rb', line 26

def collectionize
  to_s.collectionize
end