class Blogpostify::Blog
Attributes
homepage[RW]
icon[RW]
short_name[RW]
title[RW]
url[RW]
Public Class Methods
new(title, url, options={})
click to toggle source
# File lib/blogpostify/blog.rb, line 6 def initialize(title, url, options={}) self.title = title self.url = url self.short_name = options[:short_name] self.icon = options[:icon] self.homepage = options[:homepage] end
Public Instance Methods
populated?()
click to toggle source
# File lib/blogpostify/blog.rb, line 34 def populated? posts.exists? end
posts()
click to toggle source
# File lib/blogpostify/blog.rb, line 30 def posts Post.where(:blog_id => self.short_name).asc end
update_posts()
click to toggle source
# File lib/blogpostify/blog.rb, line 14 def update_posts created = [] open(self.url) do |body| rss = RSS::Parser.parse(body) rss.items.each do |post| post = Post.create_from_item(self.short_name, post) # Post not saved if guid is already registered for this blog created << post if post.persisted? end created end end