class RssNotifier::Models::Item
Public Instance Methods
changed?()
click to toggle source
# File lib/rss_notifier/models/item.rb, line 29 def changed? new_record? || @__changed end
feed()
click to toggle source
# File lib/rss_notifier/models/item.rb, line 19 def feed @feed ||= RssNotifier::Db.default.find_feed(url: feed_url) end
new_record?()
click to toggle source
# File lib/rss_notifier/models/item.rb, line 33 def new_record? !self.updated_at end
to_db_object()
click to toggle source
# File lib/rss_notifier/models/item.rb, line 48 def to_db_object { 'link' => link, 'title' => title, 'description' => description, 'date' => date, 'updated_at' => updated_at, 'feed_url' => feed_url, } end
to_h()
click to toggle source
# File lib/rss_notifier/models/item.rb, line 37 def to_h { feed_url: feed.url, feed_name: feed.name, link: link, title: title, description: description, date: date, } end
update(attributes)
click to toggle source
# File lib/rss_notifier/models/item.rb, line 23 def update(attributes) __title = self.title self.attributes = attributes @__changed = __title != self.title end