Sha256: f74228ecda606fbe05a2d8c91b68ba4618480de846f0f7eddb31168e8e991e2b

Contents?: true

Size: 879 Bytes

Versions: 21

Compression:

Stored size: 879 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 == ::Boolean || other.class == ::Boolean
          return true
        end
        super(other)
      end
    end
  end
end

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

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
mongoid-7.1.11 lib/mongoid/extensions/true_class.rb
mongoid-7.2.6 lib/mongoid/extensions/true_class.rb
mongoid-7.2.5 lib/mongoid/extensions/true_class.rb
mongoid-7.1.10 lib/mongoid/extensions/true_class.rb
mongoid-7.1.9 lib/mongoid/extensions/true_class.rb
mongoid-7.2.4 lib/mongoid/extensions/true_class.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/lib/mongoid/extensions/true_class.rb
mongoid-7.2.3 lib/mongoid/extensions/true_class.rb
mongoid-7.1.8 lib/mongoid/extensions/true_class.rb
mongoid-7.2.2 lib/mongoid/extensions/true_class.rb
mongoid-7.2.1 lib/mongoid/extensions/true_class.rb
mongoid-7.1.7 lib/mongoid/extensions/true_class.rb
mongoid-7.2.0 lib/mongoid/extensions/true_class.rb
mongoid-7.1.6 lib/mongoid/extensions/true_class.rb
mongoid-7.1.5 lib/mongoid/extensions/true_class.rb
mongoid-7.2.0.rc1 lib/mongoid/extensions/true_class.rb
mongoid-7.1.4 lib/mongoid/extensions/true_class.rb
mongoid-7.1.2 lib/mongoid/extensions/true_class.rb
mongoid-7.1.1 lib/mongoid/extensions/true_class.rb
mongoid-7.1.0 lib/mongoid/extensions/true_class.rb