lib/seymour/distributable.rb in seymour-0.0.2 vs lib/seymour/distributable.rb in seymour-0.0.3
- old
+ new
@@ -10,13 +10,12 @@
attr_accessor :audience_names, :feed_class_names
def audience(*names)
options = names.extract_options!
names.each do |name|
- class_name = options[:class_name] || name
- feed_class_name = "#{class_name.downcase.to_s.singularize}_feed".camelize
- audience_to_feed_classes[name] = feed_class_name
+ feed_name = options[:feed] || "#{name.downcase.to_s.singularize}_feed".camelize
+ audience_to_feed_classes[name] = feed_name
end
end
def audience_names
audience_to_feed_classes.keys
@@ -26,12 +25,12 @@
audience_to_feed_classes.values
end
def feeds_for(activity)
audience_to_feed_classes.map do |audience_name, feed_class_name|
- activity.send(audience_name).map { |member|
+ activity.send(audience_name).map do |member|
feed_class_name.constantize.new(member)
- }
+ end
end.flatten
end
private
\ No newline at end of file