Sha256: 03537f2c21165f02f807c5e2510c81d4ad40faf5fbf1a9c67ad84a448a0fca53

Contents?: true

Size: 818 Bytes

Versions: 9

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

module Mongoid
  module Extensions
    module TrueClass

      # Get the value of the object as a mongo friendly sort value.
      #
      # @example Get the object as sort criteria.
      #   object.__sortable__
      #
      # @return [ Integer ] 1.
      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.
      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

9 entries across 9 versions & 1 rubygems

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