Skip to content

Instantly share code, notes, and snippets.

@beeplove
Last active December 17, 2015 12:29
Show Gist options
  • Save beeplove/5610223 to your computer and use it in GitHub Desktop.
Save beeplove/5610223 to your computer and use it in GitHub Desktop.
# 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