Sha256: 0094dbc27a868a45377996c247f3864aeaa6aa6c2d89ef8cdb97a97c970e0023

Contents?: true

Size: 893 Bytes

Versions: 6

Compression:

Stored size: 893 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

module Mongoid
  module Extensions
    module TrueClass

      # Get the value of the object as a mongo friendy sort value.
      #
      # @example Get the object as sort criteria.
      #   object.__sortable__
      #
      # @return [ Integer ] 1.
      #
      # @since 3.0.0
      def __sortable__
        1
      end

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongoid-7.3.5 lib/mongoid/extensions/true_class.rb
mongoid-7.3.4 lib/mongoid/extensions/true_class.rb
mongoid-7.3.3 lib/mongoid/extensions/true_class.rb
mongoid-7.3.2 lib/mongoid/extensions/true_class.rb
mongoid-7.3.1 lib/mongoid/extensions/true_class.rb
mongoid-7.3.0 lib/mongoid/extensions/true_class.rb