Class: Hootenanny::FeedStore::FileFeedStore
- Inherits:
-
Object
- Object
- Hootenanny::FeedStore::FileFeedStore
- Defined in:
- lib/hootenanny/feed_store/file_feed_store.rb
Instance Method Summary collapse
- #fetch(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ FileFeedStore
constructor
A new instance of FileFeedStore.
- #store(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FileFeedStore
Returns a new instance of FileFeedStore.
9 10 11 |
# File 'lib/hootenanny/feed_store/file_feed_store.rb', line 9 def initialize( = {}) self.feed_file = .fetch(:location) end |
Instance Method Details
#fetch(options = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/hootenanny/feed_store/file_feed_store.rb', line 13 def fetch( = {}) self.url = .fetch(:url) feed_file = self.feed_file << [:path] << url_file_glob Hootenanny::Feed.infer(feed_file.read, type: feed_file.type) end |
#store(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/hootenanny/feed_store/file_feed_store.rb', line 21 def store( = {}) self.url = .fetch(:url) feed = .fetch(:feed) feed_type = feed.type feed_file = self.feed_file << [:path] << "#{url}.#{feed_type}" feed_file.write(feed) end |