Sha256: f8c81ee8edcf2e0ce7d29d82a92af80d0fed9118c6d6f576026318949d79e4dc

Contents?: true

Size: 819 Bytes

Versions: 16

Compression:

Stored size: 819 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

16 entries across 16 versions & 1 rubygems

Version Path
mongoid-8.1.8 lib/mongoid/extensions/true_class.rb
mongoid-8.1.7 lib/mongoid/extensions/true_class.rb
mongoid-8.1.6 lib/mongoid/extensions/true_class.rb
mongoid-8.0.8 lib/mongoid/extensions/true_class.rb
mongoid-8.1.5 lib/mongoid/extensions/true_class.rb
mongoid-8.1.4 lib/mongoid/extensions/true_class.rb
mongoid-8.0.7 lib/mongoid/extensions/true_class.rb
mongoid-8.1.3 lib/mongoid/extensions/true_class.rb
mongoid-8.1.2 lib/mongoid/extensions/true_class.rb
mongoid-8.0.6 lib/mongoid/extensions/true_class.rb
mongoid-8.1.1 lib/mongoid/extensions/true_class.rb
mongoid-8.0.5 lib/mongoid/extensions/true_class.rb
mongoid-8.1.0 lib/mongoid/extensions/true_class.rb
mongoid-8.0.4 lib/mongoid/extensions/true_class.rb
mongoid-8.0.3 lib/mongoid/extensions/true_class.rb
mongoid-8.0.2 lib/mongoid/extensions/true_class.rb