Module: Twog::BlogPostsHandler

Included in:
Twog
Defined in:
lib/twog/blog_posts_handler.rb

Instance Method Summary collapse

Instance Method Details

#get_new_blog_posts(posts, last_blog_post_tweeted) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/twog/blog_posts_handler.rb', line 3

def get_new_blog_posts(posts, last_blog_post_tweeted)
  return [] unless posts && posts.length > 0
  return posts unless last_blog_post_tweeted
  new_posts = posts.reject do |post|
    Time.parse(post.date.to_s) <= Time.parse(last_blog_post_tweeted.to_s)
  end
end