Sha256: 746651ceab1f378ecd38fac1033ab6801ac42b631d614aa20d7cdc4c507b120b
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module Feedzirra module FeedEntryUtilities def published @published || @updated end def parse_datetime(string) Time.parse(string) end ## # Returns the id of the entry or its url if not id is present, as some formats don't support it def id @id || @url end ## # Summary is @summary of @content of nil. def summary @summary || @content end ## # Writter for published. By default, we keep the "oldest" publish time found. def published=(val) parsed = parse_datetime(val) @published = parsed if !@published || parsed < @published end ## # Writter for udapted. By default, we keep the most recenet update time found. def updated=(val) parsed = parse_datetime(val) @updated = parsed if !@updated || parsed > @updated end def sanitize! self.title.sanitize! if self.title self.author.sanitize! if self.author self.summary.sanitize! if self.summary self.content.sanitize! if self.content end alias_method :last_modified, :published end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
julien51-feedzirra-0.0.14 | lib/feedzirra/feed_entry_utilities.rb |
julien51-feedzirra-0.0.16 | lib/feedzirra/feed_entry_utilities.rb |