Module: Seymour::Distributable::ClassMethods
- Defined in:
- lib/seymour/distributable.rb
Constant Summary collapse
- DEFAULT_BATCH_SIZE =
500
Instance Attribute Summary collapse
-
#audience_names ⇒ Object
Returns the value of attribute audience_names.
-
#feed_class_names ⇒ Object
Returns the value of attribute feed_class_names.
Instance Method Summary collapse
- #audience(*names) ⇒ Object
- #distribute(activity) ⇒ Object
- #feeds_for(activity) ⇒ Object
- #remove(activity) ⇒ Object
Instance Attribute Details
#audience_names ⇒ Object
Returns the value of attribute audience_names.
12 13 14 |
# File 'lib/seymour/distributable.rb', line 12 def audience_names @audience_names end |
#feed_class_names ⇒ Object
Returns the value of attribute feed_class_names.
12 13 14 |
# File 'lib/seymour/distributable.rb', line 12 def feed_class_names @feed_class_names end |
Instance Method Details
#audience(*names) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/seymour/distributable.rb', line 14 def audience(*names) = names. names.each do |name| feed_name = .delete(:feed) || "#{name.to_s.downcase.singularize}_feed".camelize audience_mappings[name] = [feed_name, ] end end |
#distribute(activity) ⇒ Object
34 35 36 |
# File 'lib/seymour/distributable.rb', line 34 def distribute(activity) tap_feeds_for(activity) { |feed| feed.push(activity) } end |
#feeds_for(activity) ⇒ Object
30 31 32 |
# File 'lib/seymour/distributable.rb', line 30 def feeds_for(activity) tap_feeds_for(activity) end |
#remove(activity) ⇒ Object
38 39 40 |
# File 'lib/seymour/distributable.rb', line 38 def remove(activity) tap_feeds_for(activity) { |feed| feed.remove(activity) } end |