123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Extensions::TrueClass

Relationships & Source Files
Defined in: lib/mongoid/extensions/true_class.rb

Overview

Adds type-casting behavior to TrueClass

Instance Method Summary

Instance Method Details

#__sortable__Integer

Deprecated.

Get the value of the object as a mongo friendly sort value.

Examples:

Get the object as sort criteria.

object.__sortable__

Returns:

[ GitHub ]

  
# File 'lib/mongoid/extensions/true_class.rb', line 15

def __sortable__
  1
end

#is_a?(other) ⇒ true | false

Is the passed value a boolean?

Examples:

Is the value a boolean type?

true.is_a?(Boolean)

Parameters:

  • other (Class)

    The class to check.

Returns:

  • (true | false)

    If the other is a boolean.

[ GitHub ]

  
# File 'lib/mongoid/extensions/true_class.rb', line 28

def is_a?(other)
  if other == Mongoid::Boolean || other.class == Mongoid::Boolean
    return true
  end
  super(other)
end