Module: Seymour::Distributable::ClassMethods

Defined in:
lib/seymour/distributable.rb

Constant Summary collapse

DEFAULT_BATCH_SIZE =
500

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#audience_namesObject

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_namesObject

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)
  options = names.extract_options!
  names.each do |name|
    feed_name = options.delete(:feed) || "#{name.to_s.downcase.singularize}_feed".camelize
    audience_mappings[name] = [feed_name, options]
  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