Last active
December 17, 2015 12:29
-
-
Save beeplove/5610223 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Todo: time complexity of #feeds is N^2, reduce it. | |
def feeds | |
[].tap do |collection| | |
collect_feed_links[:feed_entries].entries.each do |entry| | |
collection.push(sanitize_entity_hash({}.tap do |entry_hash| | |
Constants::FEED_ATTR.each do |attr| | |
begin | |
(entry.respond_to?(attr) && entry.send(attr)) ? entry_hash[attr] = entry.send(attr) : '' | |
# Probably, can be done the same with below, depends on what santitize_entity_hash does | |
# entry_hash[attr] = entry.send(attr) | |
end | |
end | |
end)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment