lib/seymour/distributable.rb in seymour-0.0.4 vs lib/seymour/distributable.rb in seymour-0.0.5
- old
+ new
@@ -32,10 +32,14 @@
end
def distribute(activity)
tap_feeds_for(activity) { |feed| feed.push(activity) }
end
+
+ def remove(activity)
+ tap_feeds_for(activity) { |feed| feed.remove(activity) }
+ end
private
def tap_feeds_for(activity, &block)
[].tap do |feeds|
@@ -55,10 +59,15 @@
end
def try_find_each(activity_audience, options = {}, &block)
if defined? activity_audience.find_each
options[:batch_size] ||= DEFAULT_BATCH_SIZE
+
+ # TODO support exclusive scope
+ # activity_audience.find_each(options) do
+ # relation.send(:with_exclusive_scope) &block
+ # end
activity_audience.find_each(options) &block
else
activity_audience.each &block
end
end
@@ -67,9 +76,13 @@
module InstanceMethods
def distribute
self.class.distribute(self)
+ end
+
+ def remove
+ self.class.remove(self)
end
def feeds
self.class.feeds_for(self)
end
\ No newline at end of file