Module: Mongoid::Extensions::TrueClass

Defined in:
build/mongoid-7.3/lib/mongoid/extensions/true_class.rb

Instance Method Summary collapse

Instance Method Details

#__sortable__Integer

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

Examples:

Get the object as sort criteria.

object.__sortable__

Returns:

Since:

  • 3.0.0



16
17
18
# File 'build/mongoid-7.3/lib/mongoid/extensions/true_class.rb', line 16

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.

Since:

  • 1.0.0



30
31
32
33
34
35
# File 'build/mongoid-7.3/lib/mongoid/extensions/true_class.rb', line 30

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