Module: FacebookWall::Factories
- Defined in:
- lib/facebook_wall/factories/methods.rb
Class Method Summary collapse
-
.create_feed_entry_filter_chain ⇒ Object
Creates a filter chain containing instances of all feed-entry filters (subclasses of FacebookWall::FeedEntryFilters::FeedEntryFilter) in FacebookWall::FeedEntryFilters.
-
.create_posts(feed, feed_entry_filter_chain) ⇒ Object
Creates wall posts from the
item
s in the specified RSS feed.
Class Method Details
.create_feed_entry_filter_chain ⇒ Object
Creates a filter chain containing instances of all feed-entry filters (subclasses of FacebookWall::FeedEntryFilters::FeedEntryFilter) in FacebookWall::FeedEntryFilters.
Returns
FacebookWall::FeedEntryFilters::Chain
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/facebook_wall/factories/methods.rb', line 7 def self.create_feed_entry_filter_chain feed_entry_filters_module = FacebookWall::FeedEntryFilters chain = feed_entry_filters_module::Chain.new feed_entry_filters_module.constants.each do |name| constant = feed_entry_filters_module.const_get name chain << constant.new if constant < feed_entry_filters_module::FeedEntryFilter end chain end |
.create_posts(feed, feed_entry_filter_chain) ⇒ Object
Creates wall posts from the item
s in the specified RSS feed.
Parameters
- feed - RSS::Rss
-
A RSS feed
- feed_entry_filter_chain - FacebookWall::FeedEntryFilters::Chain
-
A filter chain
Returns
Array of FacebookWall::Post objects
26 27 28 29 30 31 32 |
# File 'lib/facebook_wall/factories/methods.rb', line 26 def self.create_posts(feed, feed_entry_filter_chain) feed.items.collect do |entry| entry_clone = entry.clone #TODO Remove this? feed_entry_filter_chain.apply_filters_to! entry_clone FacebookWall::Post.new entry_clone end end |