Sha256: 6cf47a152d056aaf216edfc9e7411c89c53e8b0c588b0324890dbc49f10cdc30

Contents?: true

Size: 829 Bytes

Versions: 18

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

require "set"

module Mongoid
  class Criteria
    module Queryable
      module Extensions

        # This module contains additional object behavior.
        module Set
          module ClassMethods

            # Evolve the set, casting all its elements.
            #
            # @example Evolve the set.
            #   Set.evolve(set)
            #
            # @param [ Set | Object ] object The object to evolve.
            #
            # @return [ Array ] The evolved set.
            def evolve(object)
              return object if !object || !object.respond_to?(:map)
              object.map{ |obj| obj.class.evolve(obj) }
            end
          end
        end
      end
    end
  end
end

::Set.__send__(:extend, Mongoid::Criteria::Queryable::Extensions::Set::ClassMethods)

Version data entries

18 entries across 18 versions & 1 rubygems

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