lib/ohm.rb in ohm-2.0.1 vs lib/ohm.rb in ohm-2.1.0
- old
+ new
@@ -526,10 +526,24 @@
#
def except(dict)
MultiSet.new(namespace, model, key).except(dict)
end
+ # Perform an intersection between the existent set and
+ # the new set created by the union of the passed filters.
+ #
+ # Example:
+ #
+ # set = User.find(:status => "active")
+ # set.combine(:name => ["John", "Jane"])
+ #
+ # # The result will include all users with active status
+ # # and with names "John" or "Jane".
+ def combine(dict)
+ MultiSet.new(namespace, model, key).combine(dict)
+ end
+
# Do a union to the existing set using any number of filters.
#
# Example:
#
# set = User.find(:name => "John")
@@ -661,9 +675,25 @@
# User.find(:name => "John").except(:country => "US")
#
def except(dict)
MultiSet.new(
namespace, model, Command[:sdiffstore, command, unioned(dict)]
+ )
+ end
+
+ # Perform an intersection between the existent set and
+ # the new set created by the union of the passed filters.
+ #
+ # Example:
+ #
+ # set = User.find(:status => "active")
+ # set.combine(:name => ["John", "Jane"])
+ #
+ # # The result will include all users with active status
+ # # and with names "John" or "Jane".
+ def combine(dict)
+ MultiSet.new(
+ namespace, model, Command[:sinterstore, command, unioned(dict)]
)
end
# Do a union to the existing set using any number of filters.
#