Sha256: 402cafdee22ddc00afe82035c0c4de6d469b3ce0a8e0eb49d41ea49341c28cf4

Contents?: true

Size: 822 Bytes

Versions: 9

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

module Mongoid
  module Extensions
    module FalseClass

      # Get the value of the object as a mongo friendly sort value.
      #
      # @example Get the object as sort criteria.
      #   object.__sortable__
      #
      # @return [ Integer ] 0.
      def __sortable__
        0
      end

      # Is the passed value a boolean?
      #
      # @example Is the value a boolean type?
      #   false.is_a?(Boolean)
      #
      # @param [ Class ] other The class to check.
      #
      # @return [ true, false ] If the other is a boolean.
      def is_a?(other)
        if other == Mongoid::Boolean || other.class == Mongoid::Boolean
          return true
        end
        super(other)
      end
    end
  end
end

::FalseClass.__send__(:include, Mongoid::Extensions::FalseClass)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mongoid-7.5.4 lib/mongoid/extensions/false_class.rb
mongoid-7.5.3 lib/mongoid/extensions/false_class.rb
mongoid-7.5.2 lib/mongoid/extensions/false_class.rb
mongoid-7.5.1 lib/mongoid/extensions/false_class.rb
mongoid-7.4.3 lib/mongoid/extensions/false_class.rb
mongoid-8.0.1 lib/mongoid/extensions/false_class.rb
mongoid-7.5.0 lib/mongoid/extensions/false_class.rb
mongoid-7.4.1 lib/mongoid/extensions/false_class.rb
mongoid-7.4.0 lib/mongoid/extensions/false_class.rb